@wowok/agent-mcp 3.4.0 → 3.4.1
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 +8 -0
- package/dist/chain-semantics/composition-truth.d.ts +102 -0
- package/dist/chain-semantics/composition-truth.js +1 -0
- package/dist/chain-semantics/eval-order.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/index.d.ts +1 -0
- package/dist/chain-semantics/index.js +1 -1
- package/dist/composition/audit.js +1 -1
- package/dist/composition/blueprint-view.d.ts +3 -3
- package/dist/composition/blueprint-view.js +1 -1
- package/dist/composition/compile.d.ts +24 -3
- package/dist/composition/compile.js +1 -1
- package/dist/composition/emit-phases.d.ts +206 -0
- package/dist/composition/emit-phases.js +1 -0
- package/dist/composition/generate.d.ts +40 -0
- package/dist/composition/generate.js +1 -0
- package/dist/composition/guard-fill.d.ts +44 -0
- package/dist/composition/guard-fill.js +1 -0
- package/dist/composition/inflight.d.ts +20 -2
- package/dist/composition/inflight.js +1 -1
- package/dist/composition/input-normalize.d.ts +15 -0
- package/dist/composition/input-normalize.js +1 -0
- package/dist/composition/materialize.d.ts +18 -13
- package/dist/composition/materialize.js +1 -1
- package/dist/composition/mode-gates.d.ts +35 -0
- package/dist/composition/mode-gates.js +1 -0
- package/dist/composition/param-disclosure.js +1 -1
- package/dist/composition/plan-retry-ledger.d.ts +21 -0
- package/dist/composition/plan-retry-ledger.js +1 -0
- package/dist/composition/plan.d.ts +7 -2
- package/dist/composition/plan.js +1 -1
- package/dist/composition/product-card.d.ts +94 -0
- package/dist/composition/product-card.js +1 -0
- package/dist/composition/supply-chain-emit.d.ts +46 -0
- package/dist/composition/supply-chain-emit.js +1 -0
- package/dist/config/config-audit.spec.js +1 -1
- package/dist/config/config-warnings.d.ts +2 -0
- package/dist/config/config-warnings.js +1 -0
- package/dist/config/exposure.d.ts +2 -2
- package/dist/config/judgment.d.ts +31 -5
- package/dist/config/judgment.js +1 -1
- package/dist/config/judgment.spec.js +1 -1
- package/dist/config/match-policy-file.d.ts +34 -0
- package/dist/config/match-policy-file.js +1 -0
- package/dist/config/match-policy-file.spec.d.ts +1 -0
- package/dist/config/match-policy-file.spec.js +1 -0
- package/dist/config/rule-engine.d.ts +5 -5
- package/dist/config/rule-engine.js +1 -1
- package/dist/config/runtime.d.ts +0 -1
- package/dist/config/runtime.js +1 -1
- package/dist/config/severity.d.ts +0 -2
- package/dist/config/severity.js +1 -1
- package/dist/config/store-policy.spec.js +1 -1
- package/dist/config/template-params.d.ts +42 -0
- package/dist/config/template-params.js +1 -0
- package/dist/config/template-params.spec.d.ts +1 -0
- package/dist/config/template-params.spec.js +1 -0
- package/dist/data/api/api.spec.js +1 -1
- package/dist/data/api/server.js +1 -1
- package/dist/data/projection/store.d.ts +2 -1
- package/dist/data/projection/store.js +1 -1
- package/dist/data/projection/types.d.ts +22 -0
- package/dist/data/sync/cdc.d.ts +1 -2
- package/dist/data/sync/cdc.js +1 -1
- package/dist/evaluation/acceptance.d.ts +8 -0
- package/dist/evaluation/acceptance.js +1 -1
- package/dist/evaluation/builtins/demand-match.js +1 -1
- package/dist/evaluation/builtins/graph-service.spec.js +1 -1
- package/dist/evaluation/capability.d.ts +2 -0
- package/dist/evaluation/category-match-rules.d.ts +0 -1
- package/dist/evaluation/category-match-rules.js +1 -1
- package/dist/evaluation/composer.d.ts +25 -0
- package/dist/evaluation/composer.js +1 -1
- package/dist/evaluation/engine.js +1 -1
- package/dist/evaluation/extract.d.ts +7 -0
- package/dist/evaluation/extract.js +1 -1
- package/dist/evaluation/game-strategy.d.ts +0 -3
- package/dist/evaluation/game-strategy.js +1 -1
- package/dist/evaluation/match-operation.d.ts +9 -0
- package/dist/evaluation/match-operation.js +1 -1
- package/dist/evaluation/match-policy-resolver.d.ts +9 -0
- package/dist/evaluation/match-policy-resolver.js +1 -0
- package/dist/evaluation/match-policy.d.ts +3 -1
- package/dist/evaluation/match-policy.js +1 -1
- package/dist/evaluation/region.d.ts +0 -6
- package/dist/evaluation/region.js +1 -1
- package/dist/evaluation/standards.d.ts +2 -1
- package/dist/evaluation/standards.js +1 -1
- package/dist/evaluation/structured-lines.d.ts +8 -0
- package/dist/evaluation/structured-lines.js +1 -0
- package/dist/evaluation/types.d.ts +6 -0
- package/dist/experience/realtime-feedback.js +1 -1
- package/dist/extensions/capability-manifest.d.ts +1 -0
- package/dist/extensions/capability-manifest.js +1 -1
- package/dist/extensions/capability.d.ts +91 -0
- package/dist/extensions/capability.js +1 -0
- package/dist/extensions/industry-audit.spec.js +1 -1
- package/dist/extensions/industry-pack.d.ts +13 -0
- package/dist/extensions/industry-pack.js +1 -1
- package/dist/extensions/modes.js +1 -1
- package/dist/extensions/registry.d.ts +0 -2
- package/dist/extensions/registry.js +1 -1
- package/dist/goal/GoalEngine.js +1 -1
- package/dist/graph/onchain/analyze.js +1 -1
- package/dist/graph/onchain/expand.js +1 -1
- package/dist/graph/onchain/exposure.js +1 -1
- package/dist/graph/onchain/facts.js +1 -1
- package/dist/graph/onchain/order-status.d.ts +0 -1
- package/dist/graph/onchain/order-status.js +1 -1
- package/dist/harness/recover.js +1 -1
- package/dist/harness/verify.d.ts +0 -3
- package/dist/harness/verify.js +1 -1
- package/dist/intent/types.d.ts +0 -1
- package/dist/intent/types.js +1 -1
- package/dist/keeper/detectors.js +1 -1
- package/dist/keeper/types.d.ts +0 -1
- package/dist/keeper/types.js +1 -1
- package/dist/knowledge/allocation-risk.d.ts +1 -0
- package/dist/knowledge/allocation-risk.js +1 -1
- package/dist/knowledge/allocator-rail-verifier.d.ts +6 -1
- package/dist/knowledge/allocator-rail-verifier.js +1 -1
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/arbitration-puzzle.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +2 -2
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/judgment-baselines.json +21 -2
- package/dist/knowledge/baselines/rules/oracle.json +120 -0
- package/dist/knowledge/baselines/rules/plan.json +384 -17
- package/dist/knowledge/baselines/rules/progress.json +20 -2
- package/dist/knowledge/builtin-templates.d.ts +12 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/component-schema.js +1 -1
- package/dist/knowledge/contact-templates.d.ts +0 -1
- package/dist/knowledge/contact-templates.js +1 -1
- package/dist/knowledge/dynamic-pricing.js +1 -1
- package/dist/knowledge/fee-param-bindings.js +1 -1
- package/dist/knowledge/fund-layer.d.ts +1 -0
- package/dist/knowledge/fund-layer.js +1 -1
- package/dist/knowledge/game-scenarios.js +1 -1
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-binding-table.d.ts +52 -0
- package/dist/knowledge/guard-binding-table.js +1 -0
- package/dist/knowledge/guard-binding-verifier.d.ts +30 -0
- package/dist/knowledge/guard-binding-verifier.js +1 -0
- package/dist/knowledge/guard-bindings.js +1 -1
- package/dist/knowledge/guard-blueprint.d.ts +68 -0
- package/dist/knowledge/guard-blueprint.js +1 -0
- 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-host-context.d.ts +24 -0
- package/dist/knowledge/guard-host-context.js +1 -0
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-node-gates.d.ts +3 -0
- package/dist/knowledge/guard-node-gates.js +1 -1
- package/dist/knowledge/guard-puzzle.js +1 -1
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-submission-prompt.d.ts +11 -0
- package/dist/knowledge/guard-submission-prompt.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +1 -1
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/guard-translation.js +1 -1
- package/dist/knowledge/index.d.ts +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-generalizer.d.ts +6 -1
- package/dist/knowledge/industry-generalizer.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/jsonrpc-enum.d.ts +38 -0
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/machine-topology.js +1 -1
- package/dist/knowledge/machine-translation.js +1 -1
- package/dist/knowledge/object-dependency.d.ts +31 -0
- package/dist/knowledge/object-dependency.js +1 -0
- package/dist/knowledge/onchain-constants.d.ts +2 -0
- package/dist/knowledge/onchain-constants.js +1 -1
- package/dist/knowledge/param-schema.d.ts +23 -0
- package/dist/knowledge/param-schema.js +1 -1
- package/dist/knowledge/param-tiers.js +1 -1
- package/dist/knowledge/passport-ledger.js +1 -1
- package/dist/knowledge/path-oracle/coverage.d.ts +16 -0
- package/dist/knowledge/path-oracle/coverage.js +1 -0
- package/dist/knowledge/path-oracle/index.d.ts +5 -0
- package/dist/knowledge/path-oracle/index.js +1 -0
- package/dist/knowledge/path-oracle/products/food-delivery.d.ts +2 -0
- package/dist/knowledge/path-oracle/products/food-delivery.js +1 -0
- package/dist/knowledge/path-oracle/schema.d.ts +188 -0
- package/dist/knowledge/path-oracle/schema.js +1 -0
- package/dist/knowledge/pattern-resolutions.d.ts +2 -0
- package/dist/knowledge/pattern-resolutions.js +1 -1
- package/dist/knowledge/progress-ledger.js +1 -1
- package/dist/knowledge/progress-risk.js +1 -1
- package/dist/knowledge/projection.spec.js +1 -1
- package/dist/knowledge/protocol-facts.js +1 -1
- package/dist/knowledge/requirement-families.d.ts +13 -0
- package/dist/knowledge/requirement-families.js +1 -0
- package/dist/knowledge/reward-ledger.js +1 -1
- package/dist/knowledge/scenario-modes.d.ts +1 -0
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/semantic-ir.d.ts +4 -0
- package/dist/knowledge/semantic-ir.js +1 -1
- package/dist/knowledge/service-ledger.d.ts +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/sku-name-gate.d.ts +17 -0
- package/dist/knowledge/sku-name-gate.js +1 -0
- package/dist/knowledge/supply-chain.d.ts +9 -0
- package/dist/knowledge/supply-chain.js +1 -1
- package/dist/knowledge/template-loader.d.ts +14 -6
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-nav.d.ts +3 -1
- package/dist/knowledge/template-nav.js +1 -1
- package/dist/knowledge/template-prose.d.ts +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +62 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/template-test-profiles.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +5 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/radar-core.js +1 -1
- package/dist/participation/time-window.js +1 -1
- package/dist/persona/address-format.d.ts +0 -1
- package/dist/persona/address-format.js +1 -1
- package/dist/persona/bridge.js +1 -1
- package/dist/persona/index.d.ts +0 -2
- package/dist/persona/index.js +1 -1
- package/dist/persona/model.js +1 -1
- package/dist/persona/persona-audit.spec.js +1 -1
- package/dist/persona/types.d.ts +6 -0
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/game-theory.d.ts +2 -2
- package/dist/playbooks/service-build/intent-analyzer.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +50 -23
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/migration-planner.d.ts +2 -0
- package/dist/playbooks/service-build/migration-planner.js +1 -1
- package/dist/playbooks/service-build/mode-actions.js +1 -1
- package/dist/playbooks/service-build/object-panorama.d.ts +8 -0
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/reverse-mapping.d.ts +6 -0
- package/dist/playbooks/service-build/reverse-mapping.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +1 -0
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/playbooks/service-build/service-quote.spec.js +1 -1
- package/dist/playbooks/service-build/workflow-design-assessment.d.ts +10 -1
- package/dist/playbooks/service-build/workflow-design-assessment.js +1 -1
- package/dist/review/index.js +1 -1
- package/dist/review/repository.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +104 -0
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.d.ts +15 -6
- package/dist/schema/call/allocation.js +1 -1
- package/dist/schema/call/base.d.ts +256 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +32 -6
- package/dist/schema/call/demand.d.ts +15 -6
- package/dist/schema/call/demand.js +1 -1
- package/dist/schema/call/guard.d.ts +8 -8
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.d.ts +3 -0
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +32 -8
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.d.ts +26 -8
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/payment.d.ts +20 -8
- package/dist/schema/call/payment.js +1 -1
- package/dist/schema/call/permission-handler.js +1 -1
- package/dist/schema/call/permission.d.ts +330 -114
- package/dist/schema/call/permission.js +1 -1
- package/dist/schema/call/personal.d.ts +10 -4
- package/dist/schema/call/personal.js +1 -1
- package/dist/schema/call/progress.d.ts +16 -4
- package/dist/schema/call/reward.d.ts +10 -4
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.d.ts +1 -0
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +128 -40
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/call/treasury.d.ts +15 -6
- package/dist/schema/call/treasury.js +1 -1
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/config/index.d.ts +61 -0
- package/dist/schema/config/index.js +1 -1
- package/dist/schema/envelope-unify.d.ts +4 -0
- package/dist/schema/envelope-unify.js +1 -0
- package/dist/schema/evaluation/index.d.ts +216 -19
- package/dist/schema/evaluation/index.js +1 -1
- package/dist/schema/goal/index.d.ts +47 -0
- package/dist/schema/goal/planning.d.ts +115 -1
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +137 -6
- package/dist/schema/industry-pack/index.js +1 -1
- package/dist/schema/industry-pack/modes.d.ts +6 -6
- package/dist/schema/keeper/index.d.ts +26 -0
- package/dist/schema/local/index.d.ts +137 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/local/wip.d.ts +6 -0
- package/dist/schema/local/wip.js +1 -1
- package/dist/schema/messenger/index.d.ts +26 -0
- package/dist/schema/operations.d.ts +342 -83
- package/dist/schema/operations.js +1 -1
- package/dist/schema/persona/index.d.ts +2907 -640
- package/dist/schema/persona/index.js +1 -1
- package/dist/schema/query/bi.d.ts +145 -4
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +266 -73
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +1 -1
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/utils/permission-machine-check.d.ts +2 -0
- package/dist/schema/utils/permission-machine-check.js +1 -1
- package/dist/schema/watch/index.d.ts +16 -0
- package/dist/schema/watch/index.js +1 -1
- package/dist/schema/workflow/index.d.ts +2 -2
- package/dist/schema/workflow/index.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 +94 -0
- package/dist/schemas/benchmark_migration_operation.output.json +338 -9
- package/dist/schemas/benchmark_migration_operation.schema.json +26 -1
- package/dist/schemas/bridge_operation.output.json +94 -0
- package/dist/schemas/config_operation.output.json +352 -0
- package/dist/schemas/config_operation.schema.json +20 -2
- package/dist/schemas/evaluation_operation.output.json +570 -4
- package/dist/schemas/evaluation_operation.schema.json +194 -3
- package/dist/schemas/goal_operation.schema.json +183 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/industry_pack_operation.output.json +621 -0
- package/dist/schemas/industry_pack_operation.schema.json +20 -2
- package/dist/schemas/keeper_operation.output.json +94 -0
- package/dist/schemas/local_cache_operation.output.json +94 -0
- package/dist/schemas/local_history_operation.output.json +94 -0
- package/dist/schemas/local_info_operation.output.json +94 -0
- package/dist/schemas/local_mark_operation.output.json +94 -0
- package/dist/schemas/messenger_operation.output.json +94 -0
- package/dist/schemas/monitor_events.output.json +94 -0
- package/dist/schemas/monitor_subscription.output.json +94 -0
- package/dist/schemas/onchain_events.output.json +94 -0
- package/dist/schemas/onchain_operations.output.json +313 -1
- package/dist/schemas/onchain_operations.schema.json +1248 -664
- package/dist/schemas/onchain_operations_allocation.schema.json +30 -15
- package/dist/schemas/onchain_operations_arbitration.schema.json +9 -2
- package/dist/schemas/onchain_operations_contact.schema.json +8 -1
- package/dist/schemas/onchain_operations_demand.schema.json +29 -14
- package/dist/schemas/onchain_operations_gen_passport.schema.json +8 -1
- package/dist/schemas/onchain_operations_guard.schema.json +290 -105
- package/dist/schemas/onchain_operations_machine.schema.json +49 -34
- package/dist/schemas/onchain_operations_order.schema.json +63 -40
- package/dist/schemas/onchain_operations_payment.schema.json +26 -11
- package/dist/schemas/onchain_operations_permission.schema.json +362 -235
- package/dist/schemas/onchain_operations_personal.schema.json +27 -15
- package/dist/schemas/onchain_operations_progress.schema.json +45 -30
- package/dist/schemas/onchain_operations_proof.schema.json +8 -1
- package/dist/schemas/onchain_operations_repository.schema.json +8 -1
- package/dist/schemas/onchain_operations_reward.schema.json +32 -17
- package/dist/schemas/onchain_operations_service.schema.json +221 -124
- package/dist/schemas/onchain_operations_treasury.schema.json +32 -17
- package/dist/schemas/onchain_table_data.output.json +258 -6
- package/dist/schemas/onchain_table_data.schema.json +92 -52
- package/dist/schemas/persona_operation.output.json +7752 -0
- package/dist/schemas/persona_operation.schema.json +1232 -4
- package/dist/schemas/query_toolkit.output.json +756 -116
- package/dist/schemas/query_toolkit.schema.json +138 -7
- package/dist/schemas/schema_query.schema.json +1 -1
- package/dist/schemas/watch_operation.output.json +83 -0
- package/dist/schemas/wip_file.output.json +8 -0
- package/dist/schemas/workflow_operation.schema.json +2 -2
- package/dist/tools/handlers/benchmark-migration.d.ts +11 -3
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/evaluation.js +1 -1
- package/dist/tools/handlers/evaluation.spec.js +1 -1
- package/dist/tools/handlers/industry-pack.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +20 -0
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/persona.js +1 -1
- package/dist/tools/handlers/query.d.ts +8 -0
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/winner-derivation.d.ts +20 -0
- package/dist/tools/handlers/winner-derivation.js +1 -0
- package/dist/tools/handlers/wip-upload.js +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +1 -1
- package/dist/tools/registry/business.js +1 -1
- package/dist/tools/registry/config.js +1 -1
- package/dist/tools/registry/evaluation.js +1 -1
- package/dist/tools/registry/identity.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/transport-integrity.d.ts +7 -0
- package/dist/tools/transport-integrity.js +1 -0
- package/dist/tools/upgrade-check.js +1 -1
- package/dist/tools/wrap.d.ts +5 -0
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
- package/dist/extensions/business-modules.d.ts +0 -54
- package/dist/extensions/business-modules.js +0 -1
- package/dist/schemas/guard-templates.json +0 -379
|
@@ -1 +1 @@
|
|
|
1
|
-
import{MAX_NODE_COUNT,MAX_NODE_PAIR_COUNT,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT}from'./onchain-constants.js';export{MAX_NODE_COUNT,MAX_NODE_PAIR_COUNT,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT};export function analyzeTopology(a,b){const c=a['map'](w=>w['name']),d=new Set(c),e=new Map(),f=new Map();for(const w of c){e['set'](w,[]),f['set'](w,[]);}for(const x of b){!e['has'](x['prev_node'])&&x['prev_node']!==''&&e['set'](x['prev_node'],[]),!f['has'](x['next_node'])&&f['set'](x['next_node'],[]),x['prev_node']!==''&&e['get'](x['prev_node'])['push'](x['next_node']),f['get'](x['next_node'])['push'](x['prev_node']);}const g=b['filter'](y=>y['prev_node']==='')['map'](y=>y['next_node'])['filter'](y=>d['has'](y)),h=c['filter'](y=>(e['get'](y)||[])['length']===0x0),i=c['filter'](y=>!g['includes'](y)&&(f['get'](y)||[])['length']===0x0),j=c['filter'](y=>(e['get'](y)||[])['length']===0x0&&!h['includes'](y)),{has_cycles:k,cycle_nodes:l}=detectCycles(c,b),m=new Map();for(const y of c)m['set'](y,[]);for(const z of b){z['prev_node']!==''&&z['forwards']['length']>0x0&&d['has'](z['next_node'])&&m['get'](z['prev_node'])['push'](z['next_node']);}const n=findTrappedNodes(c,m,g),o=l['filter'](A=>A['some'](B=>n['trap_nodes']['includes'](B))),p=analyzeDeadBranches(b),q=findUnachievableThresholds(b),r=computeReachability(c,b),s=b['reduce']((A,B)=>A+B['forwards']['length'],0x0),t=Math['max'](0x0,...b['map'](A=>A['forwards']['length'])),u=Math['max'](0x0,...b['flatMap'](A=>A['forwards']['map'](B=>countRetainedSubmissions(B['retained_submission'])))),v={'max_node_count':a['length']<=MAX_NODE_COUNT,'max_node_pair_count':b['length']<=MAX_NODE_PAIR_COUNT,'max_forward_count':t<=MAX_FORWARD_COUNT,'max_forward_order_count':u<=MAX_FORWARD_ORDER_COUNT,'threshold_achievable':q['length']===0x0};return{'entry_nodes':g,'terminal_nodes':h,'orphaned_nodes':i,'dead_end_nodes':j,'dead_branches':p,'unachievable_thresholds':q,'has_cycles':k,'cycle_nodes':l,'has_traps':n['trap_nodes']['length']>0x0,'trap_nodes':n['trap_nodes'],'trap_cycles':o,'reachability':r,'node_count':a['length'],'pair_count':b['length'],'forward_count':s,'within_limits':v};}export function findUnachievableThresholds(a){const b=[];for(const c of a){const d=c['forwards']['length'],e=c['forwards']['reduce']((g,h)=>g+Number(h['weight']||0x0),0x0);if(e<c['threshold']){const f=c['threshold']>0x1&&d<c['threshold'];b['push']({'prev_node':c['prev_node'],'next_node':c['next_node'],'threshold':c['threshold'],'max_achievable':e,'distinct_forwards':d,'reason':f?'Threshold\x20'+c['threshold']+'\x20needs\x20'+c['threshold']+'\x20distinct\x20forwards\x20(each\x20forward\x20is\x20single-operator-locked\x20and\x20contributes\x20its\x20weight\x20at\x20most\x20once);\x20this\x20Pair\x20has\x20'+d+'\x20forward(s)\x20summing\x20to\x20'+e+'.\x20Add\x20more\x20parallel\x20forwards\x20or\x20lower\x20the\x20threshold.':'Threshold\x20'+c['threshold']+'\x20exceeds\x20max\x20achievable\x20weight\x20'+e+'\x20(sum\x20of\x20distinct\x20forward\x20weights).\x20The\x20transition\x20can\x20never\x20migrate.'});}}return b;}function countRetainedSubmissions(a){if(a===undefined||a===null)return 0x0;if(Array['isArray'](a))return a['length'];if(typeof a==='string')return a['length']>0x0?0x1:0x0;return 0x0;}export function detectCycle(a,b){const c=a['map'](d=>d['name']);return detectCycles(c,b);}function detectCycles(a,b){const c=new Map();for(const k of a)c['set'](k,[]);for(const l of b){l['prev_node']!==''&&c['has'](l['prev_node'])&&c['get'](l['prev_node'])['push'](l['next_node']);}const d=0x0,e=0x1,f=0x2,g=new Map();for(const m of a)g['set'](m,d);const h=[],i=[];function j(n){g['set'](n,e),i['push'](n);for(const o of c['get'](n)||[]){if(g['get'](o)===e){const p=i['indexOf'](o);return h['push'](i['slice'](p)),!![];}if(g['get'](o)===d){if(j(o))return!![];}}return i['pop'](),g['set'](n,f),![];}for(const n of a){g['get'](n)===d&&j(n);}return{'has_cycles':h['length']>0x0,'cycle_nodes':h};}export function findTrappedNodes(a,b,c){const d=new Set(),f=[];for(const l of c){!d['has'](l)&&(d['add'](l),f['push'](l));}while(f['length']>0x0){const m=f['shift']();for(const n of b['get'](m)||[]){!d['has'](n)&&(d['add'](n),f['push'](n));}}const g=a['filter'](o=>(b['get'](o)||[])['length']===0x0),h=new Map();for(const o of a)h['set'](o,[]);for(const [q,r]of b){for(const s of r){if(h['has'](s))h['get'](s)['push'](q);}}const i=new Set(),j=[];for(const w of g){i['add'](w),j['push'](w);}while(j['length']>0x0){const x=j['shift']();for(const y of h['get'](x)||[]){!i['has'](y)&&(i['add'](y),j['push'](y));}}const k=[...d]['filter'](z=>!i['has'](z))['sort']();return{'trap_nodes':k,'entry_reachable':d,'exit_reaching':i};}function analyzeDeadBranches(a){const b=[],c=new Map();for(const d of a){if(!c['has'](d['prev_node']))c['set'](d['prev_node'],[]);c['get'](d['prev_node'])['push'](d);}for(const [e,f]of c){if(f['length']<=0x1)continue;const g=Math['min'](...f['map'](h=>h['threshold']));for(const h of f){h['threshold']>g*0x2&&b['push']({'pair':{'prev_node':h['prev_node'],'next_node':h['next_node']},'reason':'Threshold\x20'+h['threshold']+'\x20is\x20much\x20higher\x20than\x20competing\x20minimum\x20'+g+'.\x20Likely\x20always\x20loses.','competing_with':f['filter'](i=>i!==h)['map'](i=>i['next_node'])});}}return b;}function computeReachability(a,b){const c=new Map();for(const e of a)c['set'](e,[]);for(const f of b){if(f['prev_node']!==''){if(!c['has'](f['prev_node']))c['set'](f['prev_node'],[]);c['get'](f['prev_node'])['push'](f['next_node']);}}const d=new Map();for(const g of a){const h=new Set(),i=[g];while(i['length']>0x0){const j=i['shift']();for(const k of c['get'](j)||[]){!h['has'](k)&&(h['add'](k),i['push'](k));}}d['set'](g,h);}return d;}export function isReachableFromEntry(a,b){for(const c of b['entry_nodes']){if(c===a)return!![];if(b['reachability']['get'](c)?.['has'](a))return!![];}return![];}export function getNodesReachingTerminals(a){const b=new Set();for(const [c,d]of a['reachability']){for(const e of a['terminal_nodes']){if(d['has'](e)){b['add'](c);break;}}}return b;}export function formatTopologySummary(a){const b=['Nodes:\x20'+a['node_count']+'\x20(max\x20100)','Pairs:\x20'+a['pair_count']+'\x20(max\x2040)','Forwards:\x20'+a['forward_count']+'\x20(max\x2020\x20per\x20Pair)','','Entry\x20nodes:\x20'+(a['entry_nodes']['join'](',\x20')||'(none)'),'Terminal\x20nodes:\x20'+(a['terminal_nodes']['join'](',\x20')||'(none)'),'Orphaned\x20nodes:\x20'+(a['orphaned_nodes']['join'](',\x20')||'(none)'),'Dead\x20branches:\x20'+a['dead_branches']['length'],'Unachievable\x20thresholds:\x20'+a['unachievable_thresholds']['length'],a['has_traps']?'TRAP\x20(entry-reachable,\x20no\x20exit\x20path):\x20YES\x20—\x20['+a['trap_nodes']['join'](',\x20')+']\x20❌\x20an\x20order\x20entering\x20these\x20nodes\x20can\x20never\x20reach\x20a\x20terminal':'Trap\x20(entry-reachable,\x20no\x20exit\x20path):\x20NO\x20✓\x20every\x20reachable\x20node\x20can\x20reach\x20a\x20terminal','Cycles:\x20'+(a['has_cycles']?a['cycle_nodes']['length']+'\x20found\x20(informational\x20—\x20allowed\x20on-chain;'+(a['has_traps']?'\x20a\x20trapped\x20loop\x20needs\x20a\x20cycle-breaking\x20exit':'\x20exit\x20reachability\x20verified')+')':'none'),'','Within\x20on-chain\x20limits:\x20'+(a['within_limits']['max_node_count']&&a['within_limits']['max_node_pair_count']&&a['within_limits']['max_forward_count']&&a['within_limits']['max_forward_order_count']&&a['within_limits']['threshold_achievable']?'YES\x20✓':'NO\x20❌')];return b['join']('\x0a');}export function identifyTopologyPattern(a){const b=new Map(),c=new Map();for(const d of a){if(!b['has'](d['prev_node']))b['set'](d['prev_node'],[]);b['get'](d['prev_node'])['push'](d['next_node']);if(!c['has'](d['next_node']))c['set'](d['next_node'],[]);c['get'](d['next_node'])['push'](d['prev_node']);}for(const [e,f]of b){if(f['length']>0x1&&e!=='')return'P-M-COMPETING';}for(const [g,h]of c){if(h['length']>0x1)return'P-M-FORKMERGE';}return'P-M-LINEAR';}const FUND_REVERSING_NODE_RE=/(^|_)(cancel(led)?|refund(ed)?|return(ed|_approved)?|expired)(_|$)/i;export function flattenMachineNodeEdges(a){const b=[];for(const c of Array['isArray'](a)?a:[]){const d=c,e=typeof d?.['name']==='string'?d['name']:'';for(const g of Array['isArray'](d?.['pairs'])?d['pairs']:[]){const h=typeof g?.['prev_node']==='string'?g['prev_node']:'',i=typeof g?.['next_node']==='string'&&g['next_node']?g['next_node']:e,j=typeof g?.['threshold']==='number'?g['threshold']:undefined;for(const k of Array['isArray'](g?.['forwards'])?g['forwards']:[]){const l=k,m=typeof l?.['name']==='string'?l['name']:'';if(!m||!i)continue;const n=l?.['namedOperator']??l?.['named_operator'],o=l?.['permissionIndex']??l?.['permission_index'];b['push']({'prev_node':h,'next_node':i,'forward':m,'weight':typeof l?.['weight']==='number'?l['weight']:undefined,'threshold':j,'guard':typeof l?.['guard']==='string'?l['guard']:null,'operator':typeof n==='string'?n:null,'permission_index':typeof o==='number'?o:null});}}}return b;}function bindingKey(a){return(a['threshold']??0x0)+'|'+(a['weight']??0x0)+'|'+(a['guard']??'')+'|'+(a['operator']??'')+'|'+(a['permission_index']??'');}export function findForwardAmbiguities(a){const b=new Map();for(const d of a){const f=d['prev_node']+'\x00'+d['forward'],h=b['get'](f);if(h)h['push'](d);else b['set'](f,[d]);}const c=[];for(const [,i]of b){const j=[...new Set(i['map'](p=>p['next_node']))];if(j['length']<0x2)continue;const k=j['filter'](p=>FUND_REVERSING_NODE_RE['test'](p)),l=k['length']>0x0&&k['length']<j['length'],m=new Set(i['map'](bindingKey)),n=m['size']>0x1,o=j['filter'](p=>!FUND_REVERSING_NODE_RE['test'](p));c['push']({'prev_node':i[0x0]['prev_node'],'forward':i[0x0]['forward'],'destinations':j['sort'](),'fund_conflict':l,'binding_differs':n,'severity':l?'critical':'warning','reason':l?'Forward\x20\x22'+i[0x0]['forward']+'\x22\x20from\x20\x22'+i[0x0]['prev_node']+'\x22\x20resolves\x20to\x20both\x20refund\x20node(s)\x20['+k['join'](',\x20')+']\x20and\x20continue\x20node(s)\x20['+o['join'](',\x20')+'].\x20The\x20destination\x20is\x20a\x20CALLER\x20argument,\x20so\x20the\x20wrong\x20pick\x20puts\x20the\x20order\x20in\x20a\x20node\x20whose\x20Allocator\x20never\x20fires\x20—\x20the\x20escrow\x20strands.':'Forward\x20\x22'+i[0x0]['forward']+'\x22\x20from\x20\x22'+i[0x0]['prev_node']+'\x22\x20resolves\x20to\x20'+j['length']+'\x20destinations\x20['+j['join'](',\x20')+'];\x20the\x20caller\x20picks\x20which,\x20so\x20the\x20workflow\x20outcome\x20depends\x20on\x20an\x20argument\x20the\x20Machine\x20does\x20not\x20constrain'+(n?'\x20—\x20and\x20the\x20candidate\x20edges\x20carry\x20DIFFERENT\x20guard/operator/weight\x20bindings':'')+'.'});}return c['sort']((p,q)=>p['severity']===q['severity']?0x0:p['severity']==='critical'?-0x1:0x1);}export function findShadowedForwards(a){const b=new Set(),c=[];for(const d of a){const f=d['prev_node']+'\x00'+d['next_node']+'\x00'+d['forward'];b['has'](f)?c['push']({'prev_node':d['prev_node'],'next_node':d['next_node'],'forward':d['forward']}):b['add'](f);}return c;}export function lintForwardAmbiguity(b,c='machine'){const d=flattenMachineNodeEdges(b),e=findForwardAmbiguities(d),f=findShadowedForwards(d),g=[],h=[];for(const i of e){const j=c+':\x20P0-6\x20forward\x20ambiguity\x20—\x20'+i['reason'];i['severity']==='critical'?g['push'](j+'\x20Fix:\x20give\x20each\x20destination\x20its\x20own\x20forward\x20name\x20(e.g.\x20free_cancel\x20→\x20closed_cancel,\x20supplier_confirm\x20→\x20confirmed)\x20so\x20the\x20name\x20determines\x20the\x20node.'):h['push'](j+'\x20Recommended:\x20give\x20the\x20forward\x20a\x20destination-unique\x20name\x20unless\x20this\x20fork\x20is\x20intentional\x20and\x20the\x20caller\x20is\x20told\x20to\x20choose.');}for(const k of f){h['push'](c+':\x20duplicate\x20forward\x20\x22'+k['forward']+'\x22\x20in\x20the\x20'+(k['prev_node']||'(entry)')+'→'+k['next_node']+'\x20Pair\x20—\x20'+'the\x20destination\x20node\x27s\x20edge\x20lookup\x20scans\x20forwards\x20in\x20order\x20and\x20returns\x20the\x20FIRST\x20match,\x20so\x20every\x20later\x20entry\x20with\x20that\x20name\x20is\x20unreachable\x20(dead\x20weight).\x20Rename\x20or\x20drop\x20it.');}return{'ambiguities':e,'shadowed':f,'critical':g,'warnings':h};}export function findLoopCycles(a){const b=0x0,c=0x1,d=0x2,e=new Map(),f=[],g=[],h=i=>{e['set'](i,c),f['push'](i);for(const j of a['get'](i)??[]){const k=e['get'](j)??b;if(k===c){const l=f['indexOf'](j);if(l>=0x0)g['push']({'from':i,'to':j,'cycle':f['slice'](l)});}else k===b&&h(j);}f['pop'](),e['set'](i,d);};for(const i of a['keys']()){if((e['get'](i)??b)===b)h(i);}return g;}export const MACHINE_TOPOLOGY_VERSION='1.0.0';
|
|
1
|
+
import{MAX_NODE_COUNT,MAX_NODE_PAIR_COUNT,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT}from'./onchain-constants.js';export{MAX_NODE_COUNT,MAX_NODE_PAIR_COUNT,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT};export function analyzeTopology(a,b){const c=a['map'](w=>w['name']),d=new Set(c),e=new Map(),f=new Map();for(const w of c){e['set'](w,[]),f['set'](w,[]);}for(const x of b){!e['has'](x['prev_node'])&&x['prev_node']!==''&&e['set'](x['prev_node'],[]),!f['has'](x['next_node'])&&f['set'](x['next_node'],[]),x['prev_node']!==''&&e['get'](x['prev_node'])['push'](x['next_node']),f['get'](x['next_node'])['push'](x['prev_node']);}const g=b['filter'](y=>y['prev_node']==='')['map'](y=>y['next_node'])['filter'](y=>d['has'](y)),h=c['filter'](y=>(e['get'](y)||[])['length']===0x0),i=c['filter'](y=>!g['includes'](y)&&(f['get'](y)||[])['length']===0x0),j=c['filter'](y=>(e['get'](y)||[])['length']===0x0&&!h['includes'](y)),{has_cycles:k,cycle_nodes:l}=detectCycles(c,b),m=new Map();for(const y of c)m['set'](y,[]);for(const z of b){z['prev_node']!==''&&z['forwards']['length']>0x0&&d['has'](z['next_node'])&&m['get'](z['prev_node'])['push'](z['next_node']);}const n=findTrappedNodes(c,m,g),o=l['filter'](A=>A['some'](B=>n['trap_nodes']['includes'](B))),p=analyzeDeadBranches(b),q=findUnachievableThresholds(b),r=computeReachability(c,b),s=b['reduce']((A,B)=>A+B['forwards']['length'],0x0),t=Math['max'](0x0,...b['map'](A=>A['forwards']['length'])),u=Math['max'](0x0,...b['flatMap'](A=>A['forwards']['map'](B=>countRetainedSubmissions(B['retained_submission'])))),v={'max_node_count':a['length']<=MAX_NODE_COUNT,'max_node_pair_count':b['length']<=MAX_NODE_PAIR_COUNT,'max_forward_count':t<=MAX_FORWARD_COUNT,'max_forward_order_count':u<=MAX_FORWARD_ORDER_COUNT,'threshold_achievable':q['length']===0x0};return{'entry_nodes':g,'terminal_nodes':h,'orphaned_nodes':i,'dead_end_nodes':j,'dead_branches':p,'unachievable_thresholds':q,'has_cycles':k,'cycle_nodes':l,'has_traps':n['trap_nodes']['length']>0x0,'trap_nodes':n['trap_nodes'],'trap_cycles':o,'reachability':r,'node_count':a['length'],'pair_count':b['length'],'forward_count':s,'within_limits':v};}export function findUnachievableThresholds(a){const b=[];for(const c of a){const d=c['forwards']['length'],e=c['forwards']['reduce']((g,h)=>g+Number(h['weight']||0x0),0x0);if(e<c['threshold']){const f=c['threshold']>0x1&&d<c['threshold'];b['push']({'prev_node':c['prev_node'],'next_node':c['next_node'],'threshold':c['threshold'],'max_achievable':e,'distinct_forwards':d,'reason':f?'Threshold\x20'+c['threshold']+'\x20needs\x20'+c['threshold']+'\x20distinct\x20forwards\x20(each\x20forward\x20is\x20single-operator-locked\x20and\x20contributes\x20its\x20weight\x20at\x20most\x20once);\x20this\x20Pair\x20has\x20'+d+'\x20forward(s)\x20summing\x20to\x20'+e+'.\x20Add\x20more\x20parallel\x20forwards\x20or\x20lower\x20the\x20threshold.':'Threshold\x20'+c['threshold']+'\x20exceeds\x20max\x20achievable\x20weight\x20'+e+'\x20(sum\x20of\x20distinct\x20forward\x20weights).\x20The\x20transition\x20can\x20never\x20migrate.'});}}return b;}function countRetainedSubmissions(a){if(a===undefined||a===null)return 0x0;if(Array['isArray'](a))return a['length'];if(typeof a==='string')return a['length']>0x0?0x1:0x0;return 0x0;}export function detectCycle(a,b){const c=a['map'](d=>d['name']);return detectCycles(c,b);}function detectCycles(a,b){const c=new Map();for(const k of a)c['set'](k,[]);for(const l of b){l['prev_node']!==''&&c['has'](l['prev_node'])&&c['get'](l['prev_node'])['push'](l['next_node']);}const d=0x0,e=0x1,f=0x2,g=new Map();for(const m of a)g['set'](m,d);const h=[],i=[];function j(n){g['set'](n,e),i['push'](n);for(const o of c['get'](n)||[]){if(g['get'](o)===e){const p=i['indexOf'](o);return h['push'](i['slice'](p)),!![];}if(g['get'](o)===d){if(j(o))return!![];}}return i['pop'](),g['set'](n,f),![];}for(const n of a){g['get'](n)===d&&j(n);}return{'has_cycles':h['length']>0x0,'cycle_nodes':h};}export function findTrappedNodes(a,b,c){const d=new Set(),f=[];for(const l of c){!d['has'](l)&&(d['add'](l),f['push'](l));}while(f['length']>0x0){const m=f['shift']();for(const n of b['get'](m)||[]){!d['has'](n)&&(d['add'](n),f['push'](n));}}const g=a['filter'](o=>(b['get'](o)||[])['length']===0x0),h=new Map();for(const o of a)h['set'](o,[]);for(const [q,r]of b){for(const s of r){if(h['has'](s))h['get'](s)['push'](q);}}const i=new Set(),j=[];for(const w of g){i['add'](w),j['push'](w);}while(j['length']>0x0){const x=j['shift']();for(const y of h['get'](x)||[]){!i['has'](y)&&(i['add'](y),j['push'](y));}}const k=[...d]['filter'](z=>!i['has'](z))['sort']();return{'trap_nodes':k,'entry_reachable':d,'exit_reaching':i};}function analyzeDeadBranches(a){const b=[],c=new Map();for(const d of a){if(!c['has'](d['prev_node']))c['set'](d['prev_node'],[]);c['get'](d['prev_node'])['push'](d);}for(const [,e]of c){if(e['length']<=0x1)continue;const f=Math['min'](...e['map'](g=>g['threshold']));for(const g of e){g['threshold']>f*0x2&&b['push']({'pair':{'prev_node':g['prev_node'],'next_node':g['next_node']},'reason':'Threshold\x20'+g['threshold']+'\x20is\x20much\x20higher\x20than\x20competing\x20minimum\x20'+f+'.\x20Likely\x20always\x20loses.','competing_with':e['filter'](h=>h!==g)['map'](h=>h['next_node'])});}}return b;}function computeReachability(a,b){const c=new Map();for(const e of a)c['set'](e,[]);for(const f of b){if(f['prev_node']!==''){if(!c['has'](f['prev_node']))c['set'](f['prev_node'],[]);c['get'](f['prev_node'])['push'](f['next_node']);}}const d=new Map();for(const g of a){const h=new Set(),i=[g];while(i['length']>0x0){const j=i['shift']();for(const k of c['get'](j)||[]){!h['has'](k)&&(h['add'](k),i['push'](k));}}d['set'](g,h);}return d;}export function isReachableFromEntry(a,b){for(const c of b['entry_nodes']){if(c===a)return!![];if(b['reachability']['get'](c)?.['has'](a))return!![];}return![];}export function getNodesReachingTerminals(a){const b=new Set();for(const [c,d]of a['reachability']){for(const e of a['terminal_nodes']){if(d['has'](e)){b['add'](c);break;}}}return b;}export function formatTopologySummary(a){const b=['Nodes:\x20'+a['node_count']+'\x20(max\x20100)','Pairs:\x20'+a['pair_count']+'\x20(max\x2040)','Forwards:\x20'+a['forward_count']+'\x20(max\x2020\x20per\x20Pair)','','Entry\x20nodes:\x20'+(a['entry_nodes']['join'](',\x20')||'(none)'),'Terminal\x20nodes:\x20'+(a['terminal_nodes']['join'](',\x20')||'(none)'),'Orphaned\x20nodes:\x20'+(a['orphaned_nodes']['join'](',\x20')||'(none)'),'Dead\x20branches:\x20'+a['dead_branches']['length'],'Unachievable\x20thresholds:\x20'+a['unachievable_thresholds']['length'],a['has_traps']?'TRAP\x20(entry-reachable,\x20no\x20exit\x20path):\x20YES\x20—\x20['+a['trap_nodes']['join'](',\x20')+']\x20❌\x20an\x20order\x20entering\x20these\x20nodes\x20can\x20never\x20reach\x20a\x20terminal':'Trap\x20(entry-reachable,\x20no\x20exit\x20path):\x20NO\x20✓\x20every\x20reachable\x20node\x20can\x20reach\x20a\x20terminal','Cycles:\x20'+(a['has_cycles']?a['cycle_nodes']['length']+'\x20found\x20(informational\x20—\x20allowed\x20on-chain;'+(a['has_traps']?'\x20a\x20trapped\x20loop\x20needs\x20a\x20cycle-breaking\x20exit':'\x20exit\x20reachability\x20verified')+')':'none'),'','Within\x20on-chain\x20limits:\x20'+(a['within_limits']['max_node_count']&&a['within_limits']['max_node_pair_count']&&a['within_limits']['max_forward_count']&&a['within_limits']['max_forward_order_count']&&a['within_limits']['threshold_achievable']?'YES\x20✓':'NO\x20❌')];return b['join']('\x0a');}export function identifyTopologyPattern(a){const b=new Map(),c=new Map();for(const d of a){if(!b['has'](d['prev_node']))b['set'](d['prev_node'],[]);b['get'](d['prev_node'])['push'](d['next_node']);if(!c['has'](d['next_node']))c['set'](d['next_node'],[]);c['get'](d['next_node'])['push'](d['prev_node']);}for(const [e,f]of b){if(f['length']>0x1&&e!=='')return'P-M-COMPETING';}for(const [,g]of c){if(g['length']>0x1)return'P-M-FORKMERGE';}return'P-M-LINEAR';}const FUND_REVERSING_NODE_RE=/(^|_)(cancel(led)?|refund(ed)?|return(ed|_approved)?|expired)(_|$)/i;export function flattenMachineNodeEdges(a){const b=[];for(const c of Array['isArray'](a)?a:[]){const d=c,e=typeof d?.['name']==='string'?d['name']:'';for(const g of Array['isArray'](d?.['pairs'])?d['pairs']:[]){const h=typeof g?.['prev_node']==='string'?g['prev_node']:'',i=typeof g?.['next_node']==='string'&&g['next_node']?g['next_node']:e,j=typeof g?.['threshold']==='number'?g['threshold']:undefined;for(const k of Array['isArray'](g?.['forwards'])?g['forwards']:[]){const l=k,m=typeof l?.['name']==='string'?l['name']:'';if(!m||!i)continue;const n=l?.['namedOperator']??l?.['named_operator'],o=l?.['permissionIndex']??l?.['permission_index'];b['push']({'prev_node':h,'next_node':i,'forward':m,'weight':typeof l?.['weight']==='number'?l['weight']:undefined,'threshold':j,'guard':typeof l?.['guard']==='string'?l['guard']:null,'operator':typeof n==='string'?n:null,'permission_index':typeof o==='number'?o:null});}}}return b;}function bindingKey(a){return(a['threshold']??0x0)+'|'+(a['weight']??0x0)+'|'+(a['guard']??'')+'|'+(a['operator']??'')+'|'+(a['permission_index']??'');}export function findForwardAmbiguities(a){const b=new Map();for(const d of a){const f=d['prev_node']+'\x00'+d['forward'],h=b['get'](f);if(h)h['push'](d);else b['set'](f,[d]);}const c=[];for(const [,i]of b){const j=[...new Set(i['map'](p=>p['next_node']))];if(j['length']<0x2)continue;const k=j['filter'](p=>FUND_REVERSING_NODE_RE['test'](p)),l=k['length']>0x0&&k['length']<j['length'],m=new Set(i['map'](bindingKey)),n=m['size']>0x1,o=j['filter'](p=>!FUND_REVERSING_NODE_RE['test'](p));c['push']({'prev_node':i[0x0]['prev_node'],'forward':i[0x0]['forward'],'destinations':j['sort'](),'fund_conflict':l,'binding_differs':n,'severity':l?'critical':'warning','reason':l?'Forward\x20\x22'+i[0x0]['forward']+'\x22\x20from\x20\x22'+i[0x0]['prev_node']+'\x22\x20resolves\x20to\x20both\x20refund\x20node(s)\x20['+k['join'](',\x20')+']\x20and\x20continue\x20node(s)\x20['+o['join'](',\x20')+'].\x20The\x20destination\x20is\x20a\x20CALLER\x20argument,\x20so\x20the\x20wrong\x20pick\x20puts\x20the\x20order\x20in\x20a\x20node\x20whose\x20Allocator\x20never\x20fires\x20—\x20the\x20escrow\x20strands.':'Forward\x20\x22'+i[0x0]['forward']+'\x22\x20from\x20\x22'+i[0x0]['prev_node']+'\x22\x20resolves\x20to\x20'+j['length']+'\x20destinations\x20['+j['join'](',\x20')+'];\x20the\x20caller\x20picks\x20which,\x20so\x20the\x20workflow\x20outcome\x20depends\x20on\x20an\x20argument\x20the\x20Machine\x20does\x20not\x20constrain'+(n?'\x20—\x20and\x20the\x20candidate\x20edges\x20carry\x20DIFFERENT\x20guard/operator/weight\x20bindings':'')+'.'});}return c['sort']((p,q)=>p['severity']===q['severity']?0x0:p['severity']==='critical'?-0x1:0x1);}export function findShadowedForwards(a){const b=new Set(),c=[];for(const d of a){const f=d['prev_node']+'\x00'+d['next_node']+'\x00'+d['forward'];b['has'](f)?c['push']({'prev_node':d['prev_node'],'next_node':d['next_node'],'forward':d['forward']}):b['add'](f);}return c;}export function lintForwardAmbiguity(b,c='machine'){const d=flattenMachineNodeEdges(b),e=findForwardAmbiguities(d),f=findShadowedForwards(d),g=[],h=[];for(const i of e){const j=c+':\x20P0-6\x20forward\x20ambiguity\x20—\x20'+i['reason'];i['severity']==='critical'?g['push'](j+'\x20Fix:\x20give\x20each\x20destination\x20its\x20own\x20forward\x20name\x20(e.g.\x20free_cancel\x20→\x20closed_cancel,\x20supplier_confirm\x20→\x20confirmed)\x20so\x20the\x20name\x20determines\x20the\x20node.'):h['push'](j+'\x20Recommended:\x20give\x20the\x20forward\x20a\x20destination-unique\x20name\x20unless\x20this\x20fork\x20is\x20intentional\x20and\x20the\x20caller\x20is\x20told\x20to\x20choose.');}for(const k of f){h['push'](c+':\x20duplicate\x20forward\x20\x22'+k['forward']+'\x22\x20in\x20the\x20'+(k['prev_node']||'(entry)')+'→'+k['next_node']+'\x20Pair\x20—\x20'+'the\x20destination\x20node\x27s\x20edge\x20lookup\x20scans\x20forwards\x20in\x20order\x20and\x20returns\x20the\x20FIRST\x20match,\x20so\x20every\x20later\x20entry\x20with\x20that\x20name\x20is\x20unreachable\x20(dead\x20weight).\x20Rename\x20or\x20drop\x20it.');}return{'ambiguities':e,'shadowed':f,'critical':g,'warnings':h};}export function findLoopCycles(a){const b=0x0,c=0x1,d=0x2,e=new Map(),f=[],g=[],h=i=>{e['set'](i,c),f['push'](i);for(const j of a['get'](i)??[]){const k=e['get'](j)??b;if(k===c){const l=f['indexOf'](j);if(l>=0x0)g['push']({'from':i,'to':j,'cycle':f['slice'](l)});}else k===b&&h(j);}f['pop'](),e['set'](i,d);};for(const i of a['keys']()){if((e['get'](i)??b)===b)h(i);}return g;}export const MACHINE_TOPOLOGY_VERSION='1.0.0';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SEMANTIC_TO_MACHINE_RULES=[{'id':'P-M-SEQ','pattern_name':'Sequential\x20Execution','category':'execution','semantic_intent':'Single\x20actor\x20advances\x20workflow\x20one\x20step\x20at\x20a\x20time.\x20Each\x20Pair\x20has\x20threshold=1\x20with\x20a\x20single\x20Forward\x20weight=1.','match_keywords':['sequential','linear','one\x20step\x20at\x20a\x20time'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':'dynamic','structure':'Each\x20Pair:\x20{\x20threshold:\x201,\x20forwards:\x20[{\x20name,\x20weight:\x201,\x20namedOperator\x20|\x20permissionIndex\x20}]\x20}'},'constraints':['Each\x20Forward\x20must\x20have\x20at\x20least\x20one\x20of\x20namedOperator\x20or\x20permissionIndex','weight\x20>\x200\x20(typically\x201)','Every\x20node\x20reachable\x20from\x20the\x20entry\x20must\x20be\x20able\x20to\x20reach\x20a\x20terminal\x20(a\x20loop\x20must\x20keep\x20a\x20cycle-breaking\x20exit)'],'example':{'pair':{'prev_node':'NodeA','next_node':'NodeB','threshold':0x1,'forwards':[{'name':'Advance','weight':0x1,'named_operator':''}]}}},{'id':'P-M-AND','pattern_name':'Parallel\x20AND\x20(Dual-Signature\x20Consensus)','category':'execution','semantic_intent':'Multiple\x20parties\x20must\x20ALL\x20contribute\x20to\x20advance.\x20Pair\x20threshold=N\x20with\x20N\x20DISTINCT\x20Forwards\x20(weight=1\x20each)\x20—\x20one\x20forward\x20per\x20contributing\x20operator.\x20'+'A\x20single\x20forward\x20CANNOT\x20be\x20executed\x20by\x20two\x20different\x20people:\x20each\x20forward\x20is\x20single-operator-locked\x20by\x20the\x20first\x20account\x20that\x20accomplishes\x20it\x20'+'(once\x20accomplished,\x20a\x20forward\x20is\x20locked\x20to\x20that\x20operator;\x20a\x20second\x20operator\x20re-executing\x20the\x20same\x20accomplished\x20forward\x20aborts\x20E_NOT_THE_HOLDER,\x20and\x20the\x20weight\x20is\x20counted\x20only\x20once).\x20'+'So\x20N\x20operators\x20cooperating\x20on\x20a\x20threshold-N\x20transition\x20MUST\x20each\x20have\x20their\x20own\x20forward\x20in\x20the\x20Pair.','match_keywords':['and','all','dual-sig','both\x20confirm','both\x20must'],'schema_elements':{'threshold':0x2,'forward_count':0x2,'permission_model':'mixed','pair_count':0x1,'structure':'Pair:\x20{\x20threshold:\x20N,\x20forwards:\x20[{\x20weight:\x201,\x20namedOperator:\x20\x27\x27\x20},\x20{\x20weight:\x201,\x20permissionIndex:\x202\x20}]\x20}'},'constraints':['threshold\x20must\x20equal\x20the\x20number\x20of\x20required\x20Forwards','Each\x20contributing\x20operator\x20needs\x20a\x20DISTINCT\x20Forward\x20—\x20never\x20reuse\x20one\x20forward\x20for\x20two\x20people','Each\x20Forward\x20must\x20have\x20a\x20distinct\x20permission\x20model\x20(no\x20two\x20identical)','A\x20forward\x20is\x20locked\x20by\x20its\x20first\x20operator:\x20once\x20accomplished\x20it\x20contributes\x20its\x20weight\x20once\x20and\x20re-execution\x20by\x20others\x20aborts\x20E_NOT_THE_HOLDER','If\x20either\x20party\x20fails\x20to\x20sign,\x20workflow\x20stalls\x20—\x20consider\x20adding\x20timeout\x20Guard'],'example':{'pair':{'prev_node':'Initiated','next_node':'Approved','threshold':0x2,'forwards':[{'name':'CustomerApprove','weight':0x1,'named_operator':''},{'name':'MerchantApprove','weight':0x1,'permission_index':0x2}]}}},{'id':'P-M-OR','pattern_name':'Parallel\x20OR\x20(Any-One\x20Execution)','category':'execution','semantic_intent':'Any\x20one\x20of\x20multiple\x20paths\x20can\x20advance\x20the\x20workflow.\x20Multiple\x20Pairs,\x20each\x20threshold=1.','match_keywords':['or','any','either'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':'dynamic','structure':'Multiple\x20Pairs\x20from\x20same\x20prev_node,\x20each\x20with\x20threshold=1'},'constraints':['Distinct\x20next_node\x20for\x20each\x20Pair\x20(or\x20distinct\x20Forward)','If\x20targets\x20are\x20different\x20nodes,\x20this\x20becomes\x20COMPETING\x20topology','If\x20targets\x20are\x20same\x20node,\x20alternative\x20paths\x20converge\x20(FORKMERGE)'],'example':{'pairs':[{'prev_node':'Choice','next_node':'PathA','threshold':0x1,'forwards':[{'name':'ChooseA','weight':0x1,'named_operator':''}]},{'prev_node':'Choice','next_node':'PathB','threshold':0x1,'forwards':[{'name':'ChooseB','weight':0x1,'named_operator':''}]}]}},{'id':'P-M-VOTE','pattern_name':'Weighted\x20Voting','category':'execution','semantic_intent':'Multiple\x20parties\x20vote\x20with\x20unequal\x20weights.\x20threshold=100,\x20varied\x20weights\x20(e.g.\x2060+40).\x20'+'Guard\x20extracts\x20weight\x20dynamically\x20from\x20Arbitration\x20object.','match_keywords':['vote','weight','stakeholder'],'schema_elements':{'threshold':0x64,'forward_count':'dynamic','permission_model':'mixed','pair_count':0x1,'structure':'Pair:\x20{\x20threshold:\x20100,\x20forwards:\x20[{\x20weight:\x2060,\x20permissionIndex:\x202,\x20guard:\x20arb_voting_guard\x20},\x20{\x20weight:\x208,\x20namedOperator:\x20\x27member\x27,\x20guard:\x20arb_voting_guard\x20}]\x20}'},'constraints':['Guard\x20MUST\x20check\x20arb.voted\x20has\x20[Signer]\x20to\x20prevent\x20double-voting\x20(R-X1-14\x20CRITICAL)','Weight\x20is\x20query-derived\x20from\x20Arbitration\x20object\x20(not\x20hardcoded\x20in\x20Forward)','Competing\x20Pair\x20often\x20added:\x20Approved\x20vs\x20Rejected\x20(timeout)\x20—\x20first-wins','Forward\x20weight\x20field\x20is\x20just\x20session\x20counter;\x20actual\x20weight\x20from\x20Guard'],'example':{'pair':{'prev_node':'Voting','next_node':'Approved','threshold':0x64,'forwards':[{'name':'ChiefVote','weight':0x3c,'permission_index':0x2,'guard':'arb_voting_guard'},{'name':'MemberVote','weight':0x8,'named_operator':'member','guard':'arb_voting_guard'}]}}},{'id':'P-M-HYBRID','pattern_name':'Hybrid\x20Mode\x20(Key\x20Party\x20Required\x20+\x20Others\x20Optional)','category':'execution','semantic_intent':'One\x20key\x20party\x20must\x20contribute,\x20others\x20are\x20optional.\x20threshold=5\x20with\x20mixed\x20weights\x20(3+1+1).','match_keywords':['hybrid','mixed','key\x20party'],'schema_elements':{'threshold':0x5,'forward_count':0x3,'permission_model':'mixed','pair_count':0x1,'structure':'Pair:\x20{\x20threshold:\x205,\x20forwards:\x20[{\x20weight:\x203,\x20permissionIndex:\x202\x20(key)\x20},\x20{\x20weight:\x201,\x20namedOperator:\x20\x27role1\x27\x20},\x20{\x20weight:\x201,\x20namedOperator:\x20\x27role2\x27\x20}]\x20}'},'constraints':['Key\x20party\x27s\x20weight\x20must\x20alone\x20be\x20insufficient\x20(otherwise\x20optional\x20parties\x20are\x20meaningless)','Total\x20weight\x20of\x20all\x20Forwards\x20must\x20be\x20>=\x20threshold','Each\x20Forward\x20must\x20have\x20distinct\x20permission\x20model'],'example':{'pair':{'prev_node':'Review','next_node':'Approved','threshold':0x5,'forwards':[{'name':'ManagerApprove','weight':0x3,'permission_index':0x2},{'name':'EngineerApprove','weight':0x1,'named_operator':'engineer'},{'name':'QAApprove','weight':0x1,'named_operator':'qa'}]}}},{'id':'P-M-LINEAR','pattern_name':'Linear\x20Flow\x20(No\x20Branches)','category':'topology','semantic_intent':'Workflow\x20progresses\x20in\x20a\x20straight\x20line\x20with\x20no\x20branches.','match_keywords':['linear','straight','no\x20branches'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':'dynamic','structure':'Chain\x20of\x20Pairs:\x20A->B->C->D->...->Terminal'},'constraints':['Exactly\x20one\x20entry\x20Pair\x20(prev_node=\x27\x27)','Exactly\x20one\x20terminal\x20node\x20(no\x20outgoing\x20Pairs)','Each\x20non-terminal\x20node\x20has\x20exactly\x20one\x20outgoing\x20Pair'],'example':{'topology':'Entry\x20->\x20A\x20->\x20B\x20->\x20C\x20->\x20Terminal'}},{'id':'P-M-FORKMERGE','pattern_name':'Fork-Merge\x20(Parallel\x20Branches\x20Converging)','category':'topology','semantic_intent':'Main\x20flow\x20forks\x20into\x20multiple\x20parallel\x20branches,\x20then\x20merges\x20back\x20to\x20main\x20flow.','match_keywords':['fork','merge','parallel'],'schema_elements':{'threshold':0x1,'forward_count':'dynamic','permission_model':'mixed','pair_count':'dynamic','structure':'ForkNode\x20->\x20{BranchA,\x20BranchB}\x20->\x20MergeNode'},'constraints':['Multiple\x20Pairs\x20from\x20ForkNode\x20(one\x20per\x20branch)','All\x20branches\x20must\x20eventually\x20reach\x20MergeNode','MergeNode\x20has\x20multiple\x20incoming\x20Pairs\x20(merge\x20point)','Threshold\x20at\x20MergeNode\x20determines\x20if\x20all\x20branches\x20must\x20complete\x20or\x20just\x20some'],'example':{'topology':'ForkNode\x20->\x20BranchA\x20->\x20MergeNode;\x20ForkNode\x20->\x20BranchB\x20->\x20MergeNode'}},{'id':'P-M-COMPETING','pattern_name':'Competing\x20Pairs\x20(Mutually\x20Exclusive\x20Branches)','category':'topology','semantic_intent':'Multiple\x20Pairs\x20from\x20same\x20node\x20compete;\x20first\x20Pair\x20to\x20meet\x20threshold\x20wins,\x20others\x20abandoned.','match_keywords':['competing','exclusive','race'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':'dynamic','structure':'Same\x20prev_node\x20->\x20multiple\x20next_nodes\x20(each\x20Pair\x20independent)'},'constraints':['Mutually\x20exclusive\x20—\x20only\x20one\x20Pair\x20can\x20complete\x20per\x20session','First\x20Pair\x20to\x20reach\x20threshold\x20wins','Other\x20incomplete\x20Pairs\x20are\x20abandoned','Verify\x20no\x20dead\x20branches\x20(a\x20Pair\x20that\x20always\x20loses\x20to\x20another)'],'example':{'topology':'Shipped\x20->\x20Received;\x20Shipped\x20->\x20Lost;\x20Shipped\x20->\x20Return\x20(first\x20wins)'}},{'id':'P-M-PERM-SINGLE','pattern_name':'Single\x20Permission','category':'permission','semantic_intent':'Forward\x20uses\x20only\x20one\x20permission\x20type:\x20namedOperator\x20OR\x20permissionIndex.','match_keywords':['single\x20permission'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':0x1,'structure':'Forward:\x20{\x20name,\x20weight:\x201,\x20namedOperator:\x20\x27<role>\x27\x20|\x20permissionIndex:\x20<index>\x20}\x20(only\x20one\x20set)'},'constraints':['Either\x20namedOperator\x20or\x20permissionIndex\x20is\x20set\x20(not\x20both)','Empty\x20namedOperator=\x27\x27\x20grants\x20OrderHolder\x20(order\x20owner\x20+\x20agents)'],'example':{'forward':{'name':'Ship','weight':0x1,'permission_index':0x2}}},{'id':'P-M-PERM-MIXED','pattern_name':'Mixed\x20Permission\x20(Either-Or)','category':'permission','semantic_intent':'Forward\x20allows\x20EITHER\x20permission\x20to\x20execute\x20(internal\x20staff\x20OR\x20external\x20roles).','match_keywords':['mixed\x20permission','either'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'mixed','pair_count':0x1,'structure':'Forward:\x20{\x20name,\x20weight:\x201,\x20namedOperator:\x20\x27<role>\x27,\x20permissionIndex:\x20<index>\x20}\x20(both\x20set)'},'constraints':['Both\x20namedOperator\x20and\x20permissionIndex\x20are\x20set','Executor\x20needs\x20EITHER\x20permission\x20—\x20passing\x20either\x20check\x20is\x20sufficient','Use\x20case:\x20allow\x20internal\x20staff\x20OR\x20external\x20role\x20to\x20execute\x20the\x20same\x20Forward'],'example':{'forward':{'name':'Confirm','weight':0x1,'named_operator':'auditor','permission_index':0x2}}},{'id':'P-M-CROSS-MACHINE','pattern_name':'Cross-Machine\x20Dependency','category':'integration','semantic_intent':'Machine\x20B\x27s\x20Forward\x20Guard\x20queries\x20Machine\x20A\x27s\x20Progress\x20to\x20verify\x20upstream\x20completion.','match_keywords':['cross-machine','supply\x20chain','upstream'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':0x1,'structure':'Forward:\x20{\x20guard:\x20\x27upstream_progress_guard\x27,\x20retained_submission:\x20\x27upstream_progress_id\x27\x20}'},'constraints':['Machine\x20A\x20MUST\x20be\x20published\x20before\x20Machine\x20B\x20(dependency\x20order)','Guard\x20uses\x20convert_witness=100\x20to\x20convert\x20submitted\x20Order/Progress\x20ID\x20into\x20queryable\x20Progress','Cross-Machine\x20dependency\x20is\x20one-way\x20(no\x20cycles)','Dependency\x20verification:\x20enforced\x20when\x20the\x20Progress\x20object\x20is\x20created\x20(creation\x20checks\x20the\x20bound\x20Machine\x20is\x20published\x20—\x20see\x2006\x20§14.6)','retained_submission\x20stores\x20upstream\x20Progress\x20ID\x20for\x20audit'],'example':{'forward':{'name':'VerifyUpstream','weight':0x1,'permission_index':0x2,'guard':'upstream_progress_guard','retained_submission':'upstream_progress_id'}}},{'id':'P-M-ALLOCATION-INTEGRATED','pattern_name':'Allocation-Integrated\x20Terminal','category':'integration','semantic_intent':'Terminal\x20node\x20triggers\x20Allocator\x20to\x20distribute\x20funds.\x20Allocation\x20independent\x20of\x20Machine\x20flow.','match_keywords':['allocation','fund\x20distribution','terminal'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':0x1,'structure':'Terminal\x20node\x20->\x20Allocator\x20entry\x20(configured\x20on\x20Service\x20order_allocators)'},'constraints':['Terminal\x20node\x20must\x20be\x20referenced\x20in\x20Service\x20order_allocators','Allocator\x20Guard\x20verifies\x20progress.current\x20==\x20terminal_node_name','sharing.who\x20determines\x20fund\x20recipient\x20(Entity\x20/\x20OrderHolder\x20/\x20etc.)','Multiple\x20Allocators\x20can\x20fire\x20on\x20different\x20terminal\x20nodes'],'example':{'terminal_node':'Complete','allocator':{'trigger_node':'Complete','sharing_who':'Entity','recipient':'merchant_treasury'}}}];export const NODE_FIELD_EXPLANATIONS=[{'field':'name','type':'string','required':!![],'semantic':'Node\x20name\x20(unique\x20identifier)','constraint':'<=64\x20BCS\x20bytes,\x20globally\x20unique'},{'field':'description','type':'string','required':![],'semantic':'Human-readable\x20description','constraint':'<=MAX_DESCRIPTION_LENGTH'},{'field':'b_pause','type':'boolean','required':![],'semantic':'Whether\x20node\x20is\x20paused\x20(blocks\x20execution)','constraint':'Default\x20false'},{'field':'b_submission','type':'boolean','required':![],'semantic':'Whether\x20submission\x20is\x20allowed\x20at\x20this\x20node','constraint':'Used\x20for\x20retained_submission\x20storage'}];export const PAIR_FIELD_EXPLANATIONS=[{'field':'prev_node','type':'string','required':!![],'semantic':'Source\x20node\x20(empty\x20\x27\x27\x20=\x20entry\x20point)','constraint':'Must\x20reference\x20existing\x20node\x20or\x20\x27\x27'},{'field':'next_node','type':'string','required':!![],'semantic':'Target\x20node','constraint':'Must\x20reference\x20existing\x20node'},{'field':'threshold','type':'number','required':!![],'semantic':'Required\x20total\x20forward\x20weight\x20to\x20advance','constraint':'>=0,\x20typically\x201-100'},{'field':'forwards','type':'array<Forward>','required':!![],'semantic':'List\x20of\x20Forwards\x20in\x20this\x20Pair','constraint':'1-20\x20Forwards\x20per\x20Pair'}];export const FORWARD_FIELD_EXPLANATIONS=[{'field':'name','type':'string','required':!![],'semantic':'Forward\x20name\x20(unique\x20within\x20Pair)','constraint':'<=64\x20BCS\x20bytes,\x20unique\x20within\x20Pair'},{'field':'weight','type':'number','required':!![],'semantic':'Weight\x20contribution\x20to\x20threshold','constraint':'>0,\x20typically\x201-100'},{'field':'namedOperator','type':'string\x20(optional)','required':![],'semantic':'Named\x20operator\x20role\x20(\x27\x27\x20=\x20OrderHolder)','constraint':'Optional,\x20but\x20Forward\x20needs\x20at\x20least\x20one\x20permission'},{'field':'permissionIndex','type':'number\x20(optional)','required':![],'semantic':'Permission\x20index\x20(custom\x20or\x20builtin)','constraint':'<\x20Permission.indices.length'},{'field':'guard','type':'address\x20(optional)','required':![],'semantic':'Guard\x20object\x20address\x20for\x20validation','constraint':'Must\x20be\x20CREATE-only\x20Guard,\x20already\x20created'},{'field':'retained_submission','type':'string\x20(optional)','required':![],'semantic':'Key\x20for\x20storing\x20submitted\x20values\x20in\x20history','constraint':'Uniquely\x20located\x20by\x20(current_node,\x20next_node,\x20forward_name)'}];export function identifyExecutionMode(a){const {threshold:b,forwards:c}=a,d=c['length'];if(b===0x1&&d===0x1)return'P-M-SEQ\x20(Sequential)';if(b===d&&d>=0x2){const e=c['some'](g=>g['permission_index']!==undefined)&&c['some'](g=>g['named_operator']!==undefined);return e?'P-M-AND\x20(Parallel\x20AND\x20/\x20Dual-Signature)':'P-M-AND\x20(Parallel\x20AND)';}if(b===0x64&&c['some'](g=>g['weight']<0x32&&g['weight']>0x0))return'P-M-VOTE\x20(Weighted\x20Voting)';if(b<d&&b>0x1)return'P-M-HYBRID\x20(Hybrid\x20Mode)';if(b===0x1&&d>=0x1)return'P-M-OR\x20(Parallel\x20OR)\x20or\x20P-M-SEQ\x20(if\x20single\x20Forward)';return'Unknown\x20(manual\x20review\x20needed)';}export function identifyTopology(a){const b=new Map(),c=new Map();for(const d of a){if(!b['has'](d['prev_node']))b['set'](d['prev_node'],[]);b['get'](d['prev_node'])['push'](d['next_node']);if(!c['has'](d['next_node']))c['set'](d['next_node'],[]);c['get'](d['next_node'])['push'](d['prev_node']);}for(const [e,f]of b){if(f['length']>0x1&&e!=='')return'P-M-COMPETING\x20(Competing\x20Pairs)';}for(const [g,h]of c){if(h['length']>0x1)return'P-M-FORKMERGE\x20(Fork-Merge)';}return'P-M-LINEAR\x20(Linear\x20Flow)';}export function matchSemanticPattern(a){const b=a['toLowerCase']();return SEMANTIC_TO_MACHINE_RULES['find'](c=>c['match_keywords']['some'](d=>b['includes'](d['toLowerCase']())));}export function explainForwardPermission(a){const b=a['named_operator']!==undefined&&a['named_operator']!==null,c=a['permission_index']!==undefined&&a['permission_index']!==null;if(b&&c){const d=a['named_operator']===''?'OrderHolder':'role\x20\x22'+a['named_operator']+'\x22';return'Mixed\x20permission:\x20'+d+'\x20OR\x20Permission\x20index\x20'+a['permission_index']+'\x20(either\x20sufficient)';}if(b){if(a['named_operator']==='')return'OrderHolder\x20(order\x20owner\x20+\x20agents)';return'NamedOperator\x20role\x20\x22'+a['named_operator']+'\x22';}if(c)return'Permission\x20index\x20'+a['permission_index'];return'❌\x20INVALID:\x20no\x20permission\x20set\x20(Forward\x20must\x20have\x20at\x20least\x20one\x20of\x20namedOperator\x20or\x20permissionIndex)';}export const MACHINE_CONSTRAINT_RULES=[{'id':'MC-C-01','name':'Node\x20count\x20<=\x20'+MAX_NODE_COUNT,'description':'MAX_NODE_COUNT','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-02','name':'Pair\x20count\x20per\x20node\x20<=\x20'+MAX_NODE_PAIR_COUNT,'description':'MAX_NODE_PAIR_COUNT','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-03','name':'Forward\x20count\x20per\x20Pair\x20<=\x20'+MAX_FORWARD_COUNT,'description':'MAX_FORWARD_COUNT','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-04','name':'Node\x20name\x20unique','description':'name\x20globally\x20unique','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-05','name':'Forward\x20name\x20unique\x20within\x20Pair','description':'name\x20unique\x20within\x20Pair','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-06','name':'Node\x20name\x20<=\x2064\x20BCS\x20bytes','description':'MAX_NAME_LENGTH','category':'creation','verification_location':'shared\x20name-length\x20rule','on_chain_enforced':!![]},{'id':'MC-C-07','name':'Forward\x20has\x20at\x20least\x20one\x20permission','description':'namedOperator\x20or\x20permissionIndex','category':'creation','verification_location':'wowok-machine\x20SKILL','on_chain_enforced':![]},{'id':'MC-C-08','name':'permissionIndex\x20valid','description':'<\x20Permission.indices.length','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-09','name':'Guard\x20already\x20created','description':'guard\x20field\x20references\x20existing\x20Guard','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-10','name':'Guard\x20immutable','description':'Guard.b_immutable\x20==\x20true','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-11','name':'retained_submission\x20index\x20valid','description':'Corresponds\x20to\x20Guard\x20table\x20b_submission=true','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-12','name':'prev_node\x20references\x20valid','description':'Points\x20to\x20existing\x20node\x20or\x20\x27\x27','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-13','name':'threshold\x20>=\x200','description':'Non-negative','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-14','name':'weight\x20>\x200','description':'Positive','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-15','name':'description\x20length','description':'<=\x20MAX_DESCRIPTION_LENGTH','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-16','name':'bReplace\x20scope','description':'Acts\x20on\x20existing\x20node\x27s\x20pairs\x20list,\x20not\x20whole\x20Machine','category':'node_operation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-17','name':'bReplace=false\x20merge\x20semantics','description':'Incremental\x20merge\x20by\x20prev_node\x20into\x20existing\x20pairs','category':'node_operation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-18','name':'Non-existing\x20node\x20append','description':'Appends\x20the\x20new\x20node\x20(no\x20clear\x20triggered)','category':'node_operation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-19','name':'Full\x20node\x20replacement\x20via\x20file\x20entry','description':'NodeJsonOrMarkdownFileSchema\x20(not\x20bReplace=true)','category':'node_operation','verification_location':'node\x20file\x20entry\x20handling','on_chain_enforced':![]},{'id':'MC-S-01','name':'At\x20least\x20one\x20entry\x20point','description':'Pair\x20with\x20prev_node=\x27\x27','category':'structure','verification_location':'machine\x20topology\x20check','on_chain_enforced':![]},{'id':'MC-S-02','name':'At\x20least\x20one\x20terminal','description':'Node\x20with\x20no\x20outgoing\x20Pairs','category':'structure','verification_location':'machine\x20topology\x20check','on_chain_enforced':![]},{'id':'MC-S-03','name':'No\x20orphaned\x20nodes','description':'All\x20non-entry\x20nodes\x20have\x20incoming\x20Pair','category':'structure','verification_location':'machine\x20topology\x20check','on_chain_enforced':![]},{'id':'MC-S-04','name':'No\x20dead\x20branches','description':'All\x20thresholds\x20achievable','category':'structure','verification_location':'machine\x20topology\x20check','on_chain_enforced':![]},{'id':'MC-S-05','name':'Exit\x20reachability\x20(trap-free)','description':'Every\x20entry-reachable\x20node\x20can\x20reach\x20a\x20terminal;\x20loops\x20are\x20allowed\x20on-chain\x20but\x20must\x20keep\x20a\x20cycle-breaking\x20exit','category':'structure','verification_location':'machine\x20topology\x20check','on_chain_enforced':![]},{'id':'MC-P-01','name':'All\x20Guards\x20tested','description':'gen_passport\x20passed','category':'publish','verification_location':'publish\x20confirmation\x20gate','on_chain_enforced':![]},{'id':'MC-P-02','name':'Backup\x20exported','description':'machineNode2file\x20executed','category':'publish','verification_location':'publish\x20confirmation\x20gate','on_chain_enforced':![]},{'id':'MC-P-03','name':'Testnet\x20verified','description':'(recommended)\x20testnet\x20passed','category':'publish','verification_location':'publish\x20confirmation\x20gate','on_chain_enforced':![]},{'id':'MC-P-04','name':'User\x20100%\x20confirmed','description':'ConfirmGate\x20passed','category':'publish','verification_location':'publish\x20confirmation\x20gate','on_chain_enforced':![]},{'id':'MC-P-05','name':'Service\x20created\x20(if\x20bound)','description':'Service\x20exists','category':'publish','verification_location':'workflow\x20guidance\x20step','on_chain_enforced':![]},{'id':'MC-R-01','name':'Node\x20ops\x20fail\x20after\x20publish','description':'E_ALREADY_PUBLISHED','category':'runtime','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-R-02','name':'Session\x20accumulation\x20correct','description':'weight\x20accumulation\x20logic','category':'runtime','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-R-03','name':'Competing\x20Pair\x20first-wins','description':'First\x20Pair\x20to\x20reach\x20threshold\x20wins','category':'runtime','verification_location':'on-chain','on_chain_enforced':!![]}];export function getConstraintsByCategory(a){return MACHINE_CONSTRAINT_RULES['filter'](b=>b['category']===a);}export function getConstraintById(a){return MACHINE_CONSTRAINT_RULES['find'](b=>b['id']===a);}export function getOnChainConstraints(){return MACHINE_CONSTRAINT_RULES['filter'](a=>a['on_chain_enforced']);}export function getOffChainConstraints(){return MACHINE_CONSTRAINT_RULES['filter'](a=>!a['on_chain_enforced']);}export const MACHINE_TRANSLATION_VERSION='1.0.0';export const MACHINE_PATTERNS_COUNT=SEMANTIC_TO_MACHINE_RULES['length'];export const MACHINE_CONSTRAINTS_COUNT=MACHINE_CONSTRAINT_RULES['length'];import{MAX_NODE_COUNT,MAX_NODE_PAIR_COUNT,MAX_FORWARD_COUNT}from'./onchain-constants.js';export function identifyNodeRole(a){const b=a['all_pairs']??[],c=(a['pairs']??b)['filter'](i=>i['prev_node']===a['name']),d=b['filter'](i=>i['next_node']===a['name']),e=b['some'](i=>i['prev_node']===''&&i['next_node']===a['name']),f=c['length']===0x0;if(e)return'entry';if(f)return'terminal';const g=new Set(c['map'](i=>i['next_node']));if(g['size']>0x1)return'branch';const h=new Set(d['map'](i=>i['prev_node'])['filter'](i=>i!==''));if(h['size']>0x1)return'merge';return'normal';}function explainGuardBinding(a){return{'address':a,'immutable_required':!![],'note':'Guard\x20'+a+'\x20validates\x20this\x20Forward\x27s\x20execution;\x20'+'must\x20be\x20immutable\x20(b_immutable=true)\x20and\x20pre-created\x20on-chain.'};}export function explainNode(a){const b=a['pairs']??[];return{'name':a['name'],'role':identifyNodeRole(a),'pairs':b['map'](c=>explainPair(c)),'description':a['description']};}export function explainPair(a){return{'prev_node':a['prev_node'],'next_node':a['next_node'],'threshold':a['threshold'],'execution_pattern':identifyExecutionMode(a),'forwards':a['forwards']['map'](b=>explainForward(b))};}export function explainForward(a){return{'name':a['name'],'permission':explainForwardPermission(a),'weight':a['weight'],'guard':a['guard']?explainGuardBinding(a['guard']):null,'retained_submission':a['retained_submission']??null};}
|
|
1
|
+
export const SEMANTIC_TO_MACHINE_RULES=[{'id':'P-M-SEQ','pattern_name':'Sequential\x20Execution','category':'execution','semantic_intent':'Single\x20actor\x20advances\x20workflow\x20one\x20step\x20at\x20a\x20time.\x20Each\x20Pair\x20has\x20threshold=1\x20with\x20a\x20single\x20Forward\x20weight=1.','match_keywords':['sequential','linear','one\x20step\x20at\x20a\x20time'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':'dynamic','structure':'Each\x20Pair:\x20{\x20threshold:\x201,\x20forwards:\x20[{\x20name,\x20weight:\x201,\x20namedOperator\x20|\x20permissionIndex\x20}]\x20}'},'constraints':['Each\x20Forward\x20must\x20have\x20at\x20least\x20one\x20of\x20namedOperator\x20or\x20permissionIndex','weight\x20>\x200\x20(typically\x201)','Every\x20node\x20reachable\x20from\x20the\x20entry\x20must\x20be\x20able\x20to\x20reach\x20a\x20terminal\x20(a\x20loop\x20must\x20keep\x20a\x20cycle-breaking\x20exit)'],'example':{'pair':{'prev_node':'NodeA','next_node':'NodeB','threshold':0x1,'forwards':[{'name':'Advance','weight':0x1,'named_operator':''}]}}},{'id':'P-M-AND','pattern_name':'Parallel\x20AND\x20(Dual-Signature\x20Consensus)','category':'execution','semantic_intent':'Multiple\x20parties\x20must\x20ALL\x20contribute\x20to\x20advance.\x20Pair\x20threshold=N\x20with\x20N\x20DISTINCT\x20Forwards\x20(weight=1\x20each)\x20—\x20one\x20forward\x20per\x20contributing\x20operator.\x20'+'A\x20single\x20forward\x20CANNOT\x20be\x20executed\x20by\x20two\x20different\x20people:\x20each\x20forward\x20is\x20single-operator-locked\x20by\x20the\x20first\x20account\x20that\x20accomplishes\x20it\x20'+'(once\x20accomplished,\x20a\x20forward\x20is\x20locked\x20to\x20that\x20operator;\x20a\x20second\x20operator\x20re-executing\x20the\x20same\x20accomplished\x20forward\x20aborts\x20E_NOT_THE_HOLDER,\x20and\x20the\x20weight\x20is\x20counted\x20only\x20once).\x20'+'So\x20N\x20operators\x20cooperating\x20on\x20a\x20threshold-N\x20transition\x20MUST\x20each\x20have\x20their\x20own\x20forward\x20in\x20the\x20Pair.','match_keywords':['and','all','dual-sig','both\x20confirm','both\x20must'],'schema_elements':{'threshold':0x2,'forward_count':0x2,'permission_model':'mixed','pair_count':0x1,'structure':'Pair:\x20{\x20threshold:\x20N,\x20forwards:\x20[{\x20weight:\x201,\x20namedOperator:\x20\x27\x27\x20},\x20{\x20weight:\x201,\x20permissionIndex:\x202\x20}]\x20}'},'constraints':['threshold\x20must\x20equal\x20the\x20number\x20of\x20required\x20Forwards','Each\x20contributing\x20operator\x20needs\x20a\x20DISTINCT\x20Forward\x20—\x20never\x20reuse\x20one\x20forward\x20for\x20two\x20people','Each\x20Forward\x20must\x20have\x20a\x20distinct\x20permission\x20model\x20(no\x20two\x20identical)','A\x20forward\x20is\x20locked\x20by\x20its\x20first\x20operator:\x20once\x20accomplished\x20it\x20contributes\x20its\x20weight\x20once\x20and\x20re-execution\x20by\x20others\x20aborts\x20E_NOT_THE_HOLDER','If\x20either\x20party\x20fails\x20to\x20sign,\x20workflow\x20stalls\x20—\x20consider\x20adding\x20timeout\x20Guard'],'example':{'pair':{'prev_node':'Initiated','next_node':'Approved','threshold':0x2,'forwards':[{'name':'CustomerApprove','weight':0x1,'named_operator':''},{'name':'MerchantApprove','weight':0x1,'permission_index':0x2}]}}},{'id':'P-M-OR','pattern_name':'Parallel\x20OR\x20(Any-One\x20Execution)','category':'execution','semantic_intent':'Any\x20one\x20of\x20multiple\x20paths\x20can\x20advance\x20the\x20workflow.\x20Multiple\x20Pairs,\x20each\x20threshold=1.','match_keywords':['or','any','either'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':'dynamic','structure':'Multiple\x20Pairs\x20from\x20same\x20prev_node,\x20each\x20with\x20threshold=1'},'constraints':['Distinct\x20next_node\x20for\x20each\x20Pair\x20(or\x20distinct\x20Forward)','If\x20targets\x20are\x20different\x20nodes,\x20this\x20becomes\x20COMPETING\x20topology','If\x20targets\x20are\x20same\x20node,\x20alternative\x20paths\x20converge\x20(FORKMERGE)'],'example':{'pairs':[{'prev_node':'Choice','next_node':'PathA','threshold':0x1,'forwards':[{'name':'ChooseA','weight':0x1,'named_operator':''}]},{'prev_node':'Choice','next_node':'PathB','threshold':0x1,'forwards':[{'name':'ChooseB','weight':0x1,'named_operator':''}]}]}},{'id':'P-M-VOTE','pattern_name':'Weighted\x20Voting','category':'execution','semantic_intent':'Multiple\x20parties\x20vote\x20with\x20unequal\x20weights.\x20threshold=100,\x20varied\x20weights\x20(e.g.\x2060+40).\x20'+'Guard\x20extracts\x20weight\x20dynamically\x20from\x20Arbitration\x20object.','match_keywords':['vote','weight','stakeholder'],'schema_elements':{'threshold':0x64,'forward_count':'dynamic','permission_model':'mixed','pair_count':0x1,'structure':'Pair:\x20{\x20threshold:\x20100,\x20forwards:\x20[{\x20weight:\x2060,\x20permissionIndex:\x202,\x20guard:\x20arb_voting_guard\x20},\x20{\x20weight:\x208,\x20namedOperator:\x20\x27member\x27,\x20guard:\x20arb_voting_guard\x20}]\x20}'},'constraints':['Guard\x20MUST\x20check\x20arb.voted\x20has\x20[Signer]\x20to\x20prevent\x20double-voting\x20(R-X1-14\x20CRITICAL)','Weight\x20is\x20query-derived\x20from\x20Arbitration\x20object\x20(not\x20hardcoded\x20in\x20Forward)','Competing\x20Pair\x20often\x20added:\x20Approved\x20vs\x20Rejected\x20(timeout)\x20—\x20first-wins','Forward\x20weight\x20field\x20is\x20just\x20session\x20counter;\x20actual\x20weight\x20from\x20Guard'],'example':{'pair':{'prev_node':'Voting','next_node':'Approved','threshold':0x64,'forwards':[{'name':'ChiefVote','weight':0x3c,'permission_index':0x2,'guard':'arb_voting_guard'},{'name':'MemberVote','weight':0x8,'named_operator':'member','guard':'arb_voting_guard'}]}}},{'id':'P-M-HYBRID','pattern_name':'Hybrid\x20Mode\x20(Key\x20Party\x20Required\x20+\x20Others\x20Optional)','category':'execution','semantic_intent':'One\x20key\x20party\x20must\x20contribute,\x20others\x20are\x20optional.\x20threshold=5\x20with\x20mixed\x20weights\x20(3+1+1).','match_keywords':['hybrid','mixed','key\x20party'],'schema_elements':{'threshold':0x5,'forward_count':0x3,'permission_model':'mixed','pair_count':0x1,'structure':'Pair:\x20{\x20threshold:\x205,\x20forwards:\x20[{\x20weight:\x203,\x20permissionIndex:\x202\x20(key)\x20},\x20{\x20weight:\x201,\x20namedOperator:\x20\x27role1\x27\x20},\x20{\x20weight:\x201,\x20namedOperator:\x20\x27role2\x27\x20}]\x20}'},'constraints':['Key\x20party\x27s\x20weight\x20must\x20alone\x20be\x20insufficient\x20(otherwise\x20optional\x20parties\x20are\x20meaningless)','Total\x20weight\x20of\x20all\x20Forwards\x20must\x20be\x20>=\x20threshold','Each\x20Forward\x20must\x20have\x20distinct\x20permission\x20model'],'example':{'pair':{'prev_node':'Review','next_node':'Approved','threshold':0x5,'forwards':[{'name':'ManagerApprove','weight':0x3,'permission_index':0x2},{'name':'EngineerApprove','weight':0x1,'named_operator':'engineer'},{'name':'QAApprove','weight':0x1,'named_operator':'qa'}]}}},{'id':'P-M-LINEAR','pattern_name':'Linear\x20Flow\x20(No\x20Branches)','category':'topology','semantic_intent':'Workflow\x20progresses\x20in\x20a\x20straight\x20line\x20with\x20no\x20branches.','match_keywords':['linear','straight','no\x20branches'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':'dynamic','structure':'Chain\x20of\x20Pairs:\x20A->B->C->D->...->Terminal'},'constraints':['Exactly\x20one\x20entry\x20Pair\x20(prev_node=\x27\x27)','Exactly\x20one\x20terminal\x20node\x20(no\x20outgoing\x20Pairs)','Each\x20non-terminal\x20node\x20has\x20exactly\x20one\x20outgoing\x20Pair'],'example':{'topology':'Entry\x20->\x20A\x20->\x20B\x20->\x20C\x20->\x20Terminal'}},{'id':'P-M-FORKMERGE','pattern_name':'Fork-Merge\x20(Parallel\x20Branches\x20Converging)','category':'topology','semantic_intent':'Main\x20flow\x20forks\x20into\x20multiple\x20parallel\x20branches,\x20then\x20merges\x20back\x20to\x20main\x20flow.','match_keywords':['fork','merge','parallel'],'schema_elements':{'threshold':0x1,'forward_count':'dynamic','permission_model':'mixed','pair_count':'dynamic','structure':'ForkNode\x20->\x20{BranchA,\x20BranchB}\x20->\x20MergeNode'},'constraints':['Multiple\x20Pairs\x20from\x20ForkNode\x20(one\x20per\x20branch)','All\x20branches\x20must\x20eventually\x20reach\x20MergeNode','MergeNode\x20has\x20multiple\x20incoming\x20Pairs\x20(merge\x20point)','Threshold\x20at\x20MergeNode\x20determines\x20if\x20all\x20branches\x20must\x20complete\x20or\x20just\x20some'],'example':{'topology':'ForkNode\x20->\x20BranchA\x20->\x20MergeNode;\x20ForkNode\x20->\x20BranchB\x20->\x20MergeNode'}},{'id':'P-M-COMPETING','pattern_name':'Competing\x20Pairs\x20(Mutually\x20Exclusive\x20Branches)','category':'topology','semantic_intent':'Multiple\x20Pairs\x20from\x20same\x20node\x20compete;\x20first\x20Pair\x20to\x20meet\x20threshold\x20wins,\x20others\x20abandoned.','match_keywords':['competing','exclusive','race'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':'dynamic','structure':'Same\x20prev_node\x20->\x20multiple\x20next_nodes\x20(each\x20Pair\x20independent)'},'constraints':['Mutually\x20exclusive\x20—\x20only\x20one\x20Pair\x20can\x20complete\x20per\x20session','First\x20Pair\x20to\x20reach\x20threshold\x20wins','Other\x20incomplete\x20Pairs\x20are\x20abandoned','Verify\x20no\x20dead\x20branches\x20(a\x20Pair\x20that\x20always\x20loses\x20to\x20another)'],'example':{'topology':'Shipped\x20->\x20Received;\x20Shipped\x20->\x20Lost;\x20Shipped\x20->\x20Return\x20(first\x20wins)'}},{'id':'P-M-PERM-SINGLE','pattern_name':'Single\x20Permission','category':'permission','semantic_intent':'Forward\x20uses\x20only\x20one\x20permission\x20type:\x20namedOperator\x20OR\x20permissionIndex.','match_keywords':['single\x20permission'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':0x1,'structure':'Forward:\x20{\x20name,\x20weight:\x201,\x20namedOperator:\x20\x27<role>\x27\x20|\x20permissionIndex:\x20<index>\x20}\x20(only\x20one\x20set)'},'constraints':['Either\x20namedOperator\x20or\x20permissionIndex\x20is\x20set\x20(not\x20both)','Empty\x20namedOperator=\x27\x27\x20grants\x20OrderHolder\x20(order\x20owner\x20+\x20agents)'],'example':{'forward':{'name':'Ship','weight':0x1,'permission_index':0x2}}},{'id':'P-M-PERM-MIXED','pattern_name':'Mixed\x20Permission\x20(Either-Or)','category':'permission','semantic_intent':'Forward\x20allows\x20EITHER\x20permission\x20to\x20execute\x20(internal\x20staff\x20OR\x20external\x20roles).','match_keywords':['mixed\x20permission','either'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'mixed','pair_count':0x1,'structure':'Forward:\x20{\x20name,\x20weight:\x201,\x20namedOperator:\x20\x27<role>\x27,\x20permissionIndex:\x20<index>\x20}\x20(both\x20set)'},'constraints':['Both\x20namedOperator\x20and\x20permissionIndex\x20are\x20set','Executor\x20needs\x20EITHER\x20permission\x20—\x20passing\x20either\x20check\x20is\x20sufficient','Use\x20case:\x20allow\x20internal\x20staff\x20OR\x20external\x20role\x20to\x20execute\x20the\x20same\x20Forward'],'example':{'forward':{'name':'Confirm','weight':0x1,'named_operator':'auditor','permission_index':0x2}}},{'id':'P-M-CROSS-MACHINE','pattern_name':'Cross-Machine\x20Dependency','category':'integration','semantic_intent':'Machine\x20B\x27s\x20Forward\x20Guard\x20queries\x20Machine\x20A\x27s\x20Progress\x20to\x20verify\x20upstream\x20completion.','match_keywords':['cross-machine','supply\x20chain','upstream'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':0x1,'structure':'Forward:\x20{\x20guard:\x20\x27upstream_progress_guard\x27,\x20retained_submission:\x20\x27upstream_progress_id\x27\x20}'},'constraints':['Machine\x20A\x20MUST\x20be\x20published\x20before\x20Machine\x20B\x20(dependency\x20order)','Guard\x20uses\x20convert_witness=100\x20to\x20convert\x20submitted\x20Order/Progress\x20ID\x20into\x20queryable\x20Progress','Cross-Machine\x20dependency\x20is\x20one-way\x20(no\x20cycles)','Dependency\x20verification:\x20enforced\x20when\x20the\x20Progress\x20object\x20is\x20created\x20(creation\x20checks\x20the\x20bound\x20Machine\x20is\x20published\x20—\x20see\x2006\x20§14.6)','retained_submission\x20stores\x20upstream\x20Progress\x20ID\x20for\x20audit'],'example':{'forward':{'name':'VerifyUpstream','weight':0x1,'permission_index':0x2,'guard':'upstream_progress_guard','retained_submission':'upstream_progress_id'}}},{'id':'P-M-ALLOCATION-INTEGRATED','pattern_name':'Allocation-Integrated\x20Terminal','category':'integration','semantic_intent':'Terminal\x20node\x20triggers\x20Allocator\x20to\x20distribute\x20funds.\x20Allocation\x20independent\x20of\x20Machine\x20flow.','match_keywords':['allocation','fund\x20distribution','terminal'],'schema_elements':{'threshold':0x1,'forward_count':0x1,'permission_model':'single','pair_count':0x1,'structure':'Terminal\x20node\x20->\x20Allocator\x20entry\x20(configured\x20on\x20Service\x20order_allocators)'},'constraints':['Terminal\x20node\x20must\x20be\x20referenced\x20in\x20Service\x20order_allocators','Allocator\x20Guard\x20verifies\x20progress.current\x20==\x20terminal_node_name','sharing.who\x20determines\x20fund\x20recipient\x20(Entity\x20/\x20OrderHolder\x20/\x20etc.)','Multiple\x20Allocators\x20can\x20fire\x20on\x20different\x20terminal\x20nodes'],'example':{'terminal_node':'Complete','allocator':{'trigger_node':'Complete','sharing_who':'Entity','recipient':'merchant_treasury'}}}];export const NODE_FIELD_EXPLANATIONS=[{'field':'name','type':'string','required':!![],'semantic':'Node\x20name\x20(unique\x20identifier)','constraint':'<=64\x20BCS\x20bytes,\x20globally\x20unique'},{'field':'description','type':'string','required':![],'semantic':'Human-readable\x20description','constraint':'<=MAX_DESCRIPTION_LENGTH'},{'field':'b_pause','type':'boolean','required':![],'semantic':'Whether\x20node\x20is\x20paused\x20(blocks\x20execution)','constraint':'Default\x20false'},{'field':'b_submission','type':'boolean','required':![],'semantic':'Whether\x20submission\x20is\x20allowed\x20at\x20this\x20node','constraint':'Used\x20for\x20retained_submission\x20storage'}];export const PAIR_FIELD_EXPLANATIONS=[{'field':'prev_node','type':'string','required':!![],'semantic':'Source\x20node\x20(empty\x20\x27\x27\x20=\x20entry\x20point)','constraint':'Must\x20reference\x20existing\x20node\x20or\x20\x27\x27'},{'field':'next_node','type':'string','required':!![],'semantic':'Target\x20node','constraint':'Must\x20reference\x20existing\x20node'},{'field':'threshold','type':'number','required':!![],'semantic':'Required\x20total\x20forward\x20weight\x20to\x20advance','constraint':'>=0,\x20typically\x201-100'},{'field':'forwards','type':'array<Forward>','required':!![],'semantic':'List\x20of\x20Forwards\x20in\x20this\x20Pair','constraint':'1-20\x20Forwards\x20per\x20Pair'}];export const FORWARD_FIELD_EXPLANATIONS=[{'field':'name','type':'string','required':!![],'semantic':'Forward\x20name\x20(unique\x20within\x20Pair)','constraint':'<=64\x20BCS\x20bytes,\x20unique\x20within\x20Pair'},{'field':'weight','type':'number','required':!![],'semantic':'Weight\x20contribution\x20to\x20threshold','constraint':'>0,\x20typically\x201-100'},{'field':'namedOperator','type':'string\x20(optional)','required':![],'semantic':'Named\x20operator\x20role\x20(\x27\x27\x20=\x20OrderHolder)','constraint':'Optional,\x20but\x20Forward\x20needs\x20at\x20least\x20one\x20permission'},{'field':'permissionIndex','type':'number\x20(optional)','required':![],'semantic':'Permission\x20index\x20(custom\x20or\x20builtin)','constraint':'<\x20Permission.indices.length'},{'field':'guard','type':'address\x20(optional)','required':![],'semantic':'Guard\x20object\x20address\x20for\x20validation','constraint':'Must\x20be\x20CREATE-only\x20Guard,\x20already\x20created'},{'field':'retained_submission','type':'string\x20(optional)','required':![],'semantic':'Key\x20for\x20storing\x20submitted\x20values\x20in\x20history','constraint':'Uniquely\x20located\x20by\x20(current_node,\x20next_node,\x20forward_name)'}];export function identifyExecutionMode(a){const {threshold:b,forwards:c}=a,d=c['length'];if(b===0x1&&d===0x1)return'P-M-SEQ\x20(Sequential)';if(b===d&&d>=0x2){const e=c['some'](g=>g['permission_index']!==undefined)&&c['some'](g=>g['named_operator']!==undefined);return e?'P-M-AND\x20(Parallel\x20AND\x20/\x20Dual-Signature)':'P-M-AND\x20(Parallel\x20AND)';}if(b===0x64&&c['some'](g=>g['weight']<0x32&&g['weight']>0x0))return'P-M-VOTE\x20(Weighted\x20Voting)';if(b<d&&b>0x1)return'P-M-HYBRID\x20(Hybrid\x20Mode)';if(b===0x1&&d>=0x1)return'P-M-OR\x20(Parallel\x20OR)\x20or\x20P-M-SEQ\x20(if\x20single\x20Forward)';return'Unknown\x20(manual\x20review\x20needed)';}export function identifyTopology(a){const b=new Map(),c=new Map();for(const d of a){if(!b['has'](d['prev_node']))b['set'](d['prev_node'],[]);b['get'](d['prev_node'])['push'](d['next_node']);if(!c['has'](d['next_node']))c['set'](d['next_node'],[]);c['get'](d['next_node'])['push'](d['prev_node']);}for(const [e,f]of b){if(f['length']>0x1&&e!=='')return'P-M-COMPETING\x20(Competing\x20Pairs)';}for(const [,g]of c){if(g['length']>0x1)return'P-M-FORKMERGE\x20(Fork-Merge)';}return'P-M-LINEAR\x20(Linear\x20Flow)';}export function matchSemanticPattern(a){const b=a['toLowerCase']();return SEMANTIC_TO_MACHINE_RULES['find'](c=>c['match_keywords']['some'](d=>b['includes'](d['toLowerCase']())));}export function explainForwardPermission(a){const b=a['named_operator']!==undefined&&a['named_operator']!==null,c=a['permission_index']!==undefined&&a['permission_index']!==null;if(b&&c){const d=a['named_operator']===''?'OrderHolder':'role\x20\x22'+a['named_operator']+'\x22';return'Mixed\x20permission:\x20'+d+'\x20OR\x20Permission\x20index\x20'+a['permission_index']+'\x20(either\x20sufficient)';}if(b){if(a['named_operator']==='')return'OrderHolder\x20(order\x20owner\x20+\x20agents)';return'NamedOperator\x20role\x20\x22'+a['named_operator']+'\x22';}if(c)return'Permission\x20index\x20'+a['permission_index'];return'❌\x20INVALID:\x20no\x20permission\x20set\x20(Forward\x20must\x20have\x20at\x20least\x20one\x20of\x20namedOperator\x20or\x20permissionIndex)';}export const MACHINE_CONSTRAINT_RULES=[{'id':'MC-C-01','name':'Node\x20count\x20<=\x20'+MAX_NODE_COUNT,'description':'MAX_NODE_COUNT','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-02','name':'Pair\x20count\x20per\x20node\x20<=\x20'+MAX_NODE_PAIR_COUNT,'description':'MAX_NODE_PAIR_COUNT','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-03','name':'Forward\x20count\x20per\x20Pair\x20<=\x20'+MAX_FORWARD_COUNT,'description':'MAX_FORWARD_COUNT','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-04','name':'Node\x20name\x20unique','description':'name\x20globally\x20unique','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-05','name':'Forward\x20name\x20unique\x20within\x20Pair','description':'name\x20unique\x20within\x20Pair','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-06','name':'Node\x20name\x20<=\x2064\x20BCS\x20bytes','description':'MAX_NAME_LENGTH','category':'creation','verification_location':'shared\x20name-length\x20rule','on_chain_enforced':!![]},{'id':'MC-C-07','name':'Forward\x20has\x20at\x20least\x20one\x20permission','description':'namedOperator\x20or\x20permissionIndex','category':'creation','verification_location':'wowok-machine\x20SKILL','on_chain_enforced':![]},{'id':'MC-C-08','name':'permissionIndex\x20valid','description':'<\x20Permission.indices.length','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-09','name':'Guard\x20already\x20created','description':'guard\x20field\x20references\x20existing\x20Guard','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-10','name':'Guard\x20immutable','description':'Guard.b_immutable\x20==\x20true','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-11','name':'retained_submission\x20index\x20valid','description':'Corresponds\x20to\x20Guard\x20table\x20b_submission=true','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-12','name':'prev_node\x20references\x20valid','description':'Points\x20to\x20existing\x20node\x20or\x20\x27\x27','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-13','name':'threshold\x20>=\x200','description':'Non-negative','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-14','name':'weight\x20>\x200','description':'Positive','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-15','name':'description\x20length','description':'<=\x20MAX_DESCRIPTION_LENGTH','category':'creation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-16','name':'bReplace\x20scope','description':'Acts\x20on\x20existing\x20node\x27s\x20pairs\x20list,\x20not\x20whole\x20Machine','category':'node_operation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-17','name':'bReplace=false\x20merge\x20semantics','description':'Incremental\x20merge\x20by\x20prev_node\x20into\x20existing\x20pairs','category':'node_operation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-18','name':'Non-existing\x20node\x20append','description':'Appends\x20the\x20new\x20node\x20(no\x20clear\x20triggered)','category':'node_operation','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-C-19','name':'Full\x20node\x20replacement\x20via\x20file\x20entry','description':'NodeJsonOrMarkdownFileSchema\x20(not\x20bReplace=true)','category':'node_operation','verification_location':'node\x20file\x20entry\x20handling','on_chain_enforced':![]},{'id':'MC-S-01','name':'At\x20least\x20one\x20entry\x20point','description':'Pair\x20with\x20prev_node=\x27\x27','category':'structure','verification_location':'machine\x20topology\x20check','on_chain_enforced':![]},{'id':'MC-S-02','name':'At\x20least\x20one\x20terminal','description':'Node\x20with\x20no\x20outgoing\x20Pairs','category':'structure','verification_location':'machine\x20topology\x20check','on_chain_enforced':![]},{'id':'MC-S-03','name':'No\x20orphaned\x20nodes','description':'All\x20non-entry\x20nodes\x20have\x20incoming\x20Pair','category':'structure','verification_location':'machine\x20topology\x20check','on_chain_enforced':![]},{'id':'MC-S-04','name':'No\x20dead\x20branches','description':'All\x20thresholds\x20achievable','category':'structure','verification_location':'machine\x20topology\x20check','on_chain_enforced':![]},{'id':'MC-S-05','name':'Exit\x20reachability\x20(trap-free)','description':'Every\x20entry-reachable\x20node\x20can\x20reach\x20a\x20terminal;\x20loops\x20are\x20allowed\x20on-chain\x20but\x20must\x20keep\x20a\x20cycle-breaking\x20exit','category':'structure','verification_location':'machine\x20topology\x20check','on_chain_enforced':![]},{'id':'MC-P-01','name':'All\x20Guards\x20tested','description':'gen_passport\x20passed','category':'publish','verification_location':'publish\x20confirmation\x20gate','on_chain_enforced':![]},{'id':'MC-P-02','name':'Backup\x20exported','description':'machineNode2file\x20executed','category':'publish','verification_location':'publish\x20confirmation\x20gate','on_chain_enforced':![]},{'id':'MC-P-03','name':'Testnet\x20verified','description':'(recommended)\x20testnet\x20passed','category':'publish','verification_location':'publish\x20confirmation\x20gate','on_chain_enforced':![]},{'id':'MC-P-04','name':'User\x20100%\x20confirmed','description':'ConfirmGate\x20passed','category':'publish','verification_location':'publish\x20confirmation\x20gate','on_chain_enforced':![]},{'id':'MC-P-05','name':'Service\x20created\x20(if\x20bound)','description':'Service\x20exists','category':'publish','verification_location':'workflow\x20guidance\x20step','on_chain_enforced':![]},{'id':'MC-R-01','name':'Node\x20ops\x20fail\x20after\x20publish','description':'E_ALREADY_PUBLISHED','category':'runtime','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-R-02','name':'Session\x20accumulation\x20correct','description':'weight\x20accumulation\x20logic','category':'runtime','verification_location':'on-chain','on_chain_enforced':!![]},{'id':'MC-R-03','name':'Competing\x20Pair\x20first-wins','description':'First\x20Pair\x20to\x20reach\x20threshold\x20wins','category':'runtime','verification_location':'on-chain','on_chain_enforced':!![]}];export function getConstraintsByCategory(a){return MACHINE_CONSTRAINT_RULES['filter'](b=>b['category']===a);}export function getConstraintById(a){return MACHINE_CONSTRAINT_RULES['find'](b=>b['id']===a);}export function getOnChainConstraints(){return MACHINE_CONSTRAINT_RULES['filter'](a=>a['on_chain_enforced']);}export function getOffChainConstraints(){return MACHINE_CONSTRAINT_RULES['filter'](a=>!a['on_chain_enforced']);}export const MACHINE_TRANSLATION_VERSION='1.0.0';export const MACHINE_PATTERNS_COUNT=SEMANTIC_TO_MACHINE_RULES['length'];export const MACHINE_CONSTRAINTS_COUNT=MACHINE_CONSTRAINT_RULES['length'];import{MAX_NODE_COUNT,MAX_NODE_PAIR_COUNT,MAX_FORWARD_COUNT}from'./onchain-constants.js';export function identifyNodeRole(a){const b=a['all_pairs']??[],c=(a['pairs']??b)['filter'](i=>i['prev_node']===a['name']),d=b['filter'](i=>i['next_node']===a['name']),e=b['some'](i=>i['prev_node']===''&&i['next_node']===a['name']),f=c['length']===0x0;if(e)return'entry';if(f)return'terminal';const g=new Set(c['map'](i=>i['next_node']));if(g['size']>0x1)return'branch';const h=new Set(d['map'](i=>i['prev_node'])['filter'](i=>i!==''));if(h['size']>0x1)return'merge';return'normal';}function explainGuardBinding(a){return{'address':a,'immutable_required':!![],'note':'Guard\x20'+a+'\x20validates\x20this\x20Forward\x27s\x20execution;\x20'+'must\x20be\x20immutable\x20(b_immutable=true)\x20and\x20pre-created\x20on-chain.'};}export function explainNode(a){const b=a['pairs']??[];return{'name':a['name'],'role':identifyNodeRole(a),'pairs':b['map'](c=>explainPair(c)),'description':a['description']};}export function explainPair(a){return{'prev_node':a['prev_node'],'next_node':a['next_node'],'threshold':a['threshold'],'execution_pattern':identifyExecutionMode(a),'forwards':a['forwards']['map'](b=>explainForward(b))};}export function explainForward(a){return{'name':a['name'],'permission':explainForwardPermission(a),'weight':a['weight'],'guard':a['guard']?explainGuardBinding(a['guard']):null,'retained_submission':a['retained_submission']??null};}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export type RelationDependencyDirection = "from_depends_on_to" | "to_depends_on_from";
|
|
2
|
+
export declare const RELATION_DEPENDENCY_DIRECTION: Record<string, RelationDependencyDirection>;
|
|
3
|
+
export declare function relationDirection(relation: string): RelationDependencyDirection;
|
|
4
|
+
export interface CreationDraftDependencyRule {
|
|
5
|
+
id: string;
|
|
6
|
+
dependent: string;
|
|
7
|
+
provider: string;
|
|
8
|
+
reason: string;
|
|
9
|
+
}
|
|
10
|
+
export declare const GUARD_AFTER_SERVICE_DRAFT: CreationDraftDependencyRule;
|
|
11
|
+
export interface CreationCycleRule {
|
|
12
|
+
id: string;
|
|
13
|
+
dependent: string;
|
|
14
|
+
provider: string;
|
|
15
|
+
surface: string;
|
|
16
|
+
cycle_policy: "draft_first_configure_later";
|
|
17
|
+
remedy: {
|
|
18
|
+
strip_field: string;
|
|
19
|
+
draft_publish: boolean;
|
|
20
|
+
steps: ["draft_without_field", "create_providers", "configure_and_publish"];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare const SVC_GUARD_ALLOCATOR_CYCLE: CreationCycleRule;
|
|
24
|
+
export declare function getCreationCycleRule(dependent: string, provider: string, surfaceFragment: string): CreationCycleRule | undefined;
|
|
25
|
+
export interface CompilePhase {
|
|
26
|
+
phase: string;
|
|
27
|
+
step_ids: string[];
|
|
28
|
+
reason: string;
|
|
29
|
+
}
|
|
30
|
+
export declare const CANONICAL_COMPILE_ORDER: CompilePhase[];
|
|
31
|
+
export declare function compilePhaseRank(stepId: string): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const RELATION_DEPENDENCY_DIRECTION={'has_guard':'to_depends_on_from'};export function relationDirection(a){return RELATION_DEPENDENCY_DIRECTION[a]??'from_depends_on_to';}export const GUARD_AFTER_SERVICE_DRAFT={'id':'GUARD_AFTER_SERVICE_DRAFT','dependent':'guard','provider':'service','reason':'Guard\x20DSL\x20may\x20bind\x20the\x20service\x20by\x20name\x20(order.service\x20==\x20<service>);\x20the\x20LocalMark\x20'+'entry\x20only\x20resolves\x20once\x20the\x20service\x20draft\x20exists,\x20so\x20every\x20guard\x20node\x20conservatively\x20'+'depends\x20on\x20every\x20service\x20node.'};export const SVC_GUARD_ALLOCATOR_CYCLE={'id':'SVC_GUARD_ALLOCATOR_CYCLE','dependent':'service','provider':'guard','surface':'service.order_allocators[].guard','cycle_policy':'draft_first_configure_later','remedy':{'strip_field':'order_allocators','draft_publish':![],'steps':['draft_without_field','create_providers','configure_and_publish']}};export function getCreationCycleRule(a,b,c){const d=[SVC_GUARD_ALLOCATOR_CYCLE];return d['find'](e=>e['dependent']===a&&e['provider']===b&&e['surface']['includes'](c));}export const CANONICAL_COMPILE_ORDER=[{'phase':'identity','step_ids':['permission','permission_arb','contact'],'reason':'Permissions\x20and\x20contact\x20exist\x20before\x20anything\x20binds\x20them.'},{'phase':'reward_draft','step_ids':['reward_review'],'reason':'The\x20review\x20Reward\x20draft\x20precedes\x20the\x20service\x20that\x20references\x20it.'},{'phase':'service_draft','step_ids':['service'],'reason':'The\x20service\x20draft\x20(unpublished)\x20establishes\x20the\x20LocalMark\x20name\x20every\x20later\x20step\x20binds.'},{'phase':'repository','step_ids':['repository','repository_review'],'reason':'Repositories\x20bind\x20plan-created\x20guards\x20only\x20AFTER\x20the\x20guard\x20wave;\x20the\x20creates\x20precede\x20it.'},{'phase':'guards_wave','step_ids':[],'reason':'ONE\x20guard\x20wave\x20after\x20the\x20service/repository\x20drafts\x20(guard\x20DSL\x20resolves\x20their\x20names);\x20'+'matched\x20by\x20the\x20\x27guard_\x27\x20step-id\x20prefix.'},{'phase':'repository_write_guards','step_ids':['repository_write_guards'],'reason':'Write_guard\x20binding\x20lands\x20after\x20the\x20guards\x20it\x20references\x20exist\x20(F-05\x20split-create).'},{'phase':'machine','step_ids':['machine','machine_publish'],'reason':'Machine\x20create/publish\x20after\x20its\x20guard\x20wave\x20(edge\x20guards\x20must\x20exist).'},{'phase':'service_configure','step_ids':['service_machine','service_repository','service_buy_guard'],'reason':'Service\x20fields\x20bound\x20to\x20published\x20machine/repository/guards,\x20before\x20the\x20freezing\x20publish.'},{'phase':'allocators','step_ids':['service_allocators','service_sales'],'reason':'order_allocators/sales\x20freeze\x20at\x20publish\x20—\x20configured\x20last,\x20immediately\x20before\x20it.'}];const GUARDS_WAVE_PREFIX='guard_';export function compilePhaseRank(a){for(let b=0x0;b<CANONICAL_COMPILE_ORDER['length'];b++){if(CANONICAL_COMPILE_ORDER[b]['step_ids']['includes'](a))return b;}if(a['startsWith'](GUARDS_WAVE_PREFIX))return CANONICAL_COMPILE_ORDER['findIndex'](c=>c['phase']==='guards_wave');return-0x1;}
|
|
@@ -4,5 +4,7 @@ export { ONCHAIN_CONSTANTS, MAX_NODE_COUNT, MAX_NODE_COUNT_ONCHAIN, MAX_FORWARD_
|
|
|
4
4
|
export { REGISTRAR_ADDRESS, ENTITY_OBJECT_ADDRESS, };
|
|
5
5
|
export declare const TASK_BINDING_SLOT = 254;
|
|
6
6
|
export declare const ONCE_SLOT_BYTES = 255;
|
|
7
|
+
export declare function declaresTaskBindingSlot(table: unknown): boolean;
|
|
8
|
+
export declare function callerIndependentSlots(table: unknown): number[];
|
|
7
9
|
export declare const ONCHAIN_CONSTANT_MCP_CONSUMERS: Record<string, string[]>;
|
|
8
10
|
export declare function getOnchainConstant(name: OnchainConstantName): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ONCHAIN_CONSTANTS,MAX_NODE_COUNT,MAX_NODE_COUNT_ONCHAIN,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT,MAX_NODE_PAIR_COUNT,MAX_CONSENSUS_REPOSITORIES_COUNT,USER_DEFINED_PERM_INDEX_START,MAX_PERM_FOR_ENTITY,MAX_ADMIN_COUNT,MAX_ITEM_COUNT,ROLE_OWNER,ROLE_ADMIN,ROLE_ENTITY,MAX_AGENT_COUNT,MAX_DISPUTE_COUNT,MAX_SHARING_COUNT,MAX_VOTING_GUARD_COUNT,MAX_POLICY_COUNT,MAX_ID_COUNT_ONCE,MAX_REWARD_COUNT,MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD,MAX_CONTEXT_REPOSITORY_COUNT,MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_IM_COUNT,MAX_TAGS_COUNT,MAX_RECIPIENT_COUNT,MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT,MAX_OBJECTION_ROUNDS,WITHDRAW_DURATION_TIME,MAX_ADDRESS_COUNT,MAX_RECORD_LENGTH,BRIDGE_MESSAGE_VERSION,BRIDGE_EVM_ADDRESS_LENGTH,BRIDGE_CURRENT_VERSION,BRIDGE_TRANSFER_STATUS_PENDING,BRIDGE_TRANSFER_STATUS_APPROVED,BRIDGE_TRANSFER_STATUS_CLAIMED,BRIDGE_TRANSFER_STATUS_NOT_FOUND,MAX_INDEMNITY_MULTIPLE,MAX_PRESENTER_COUNT,MAX_INPUT_SIZE,MAX_TABLE_SIZE,MAX_DEPENDED_COUNT,MAX_DISCOUNT_TOTAL_COUNT,MAX_USER_IDENTIFIER}from'@wowok/wowok';import{REGISTRAR_ADDRESS,ENTITY_OBJECT_ADDRESS}from'@wowok/wowok';export{ONCHAIN_CONSTANTS,MAX_NODE_COUNT,MAX_NODE_COUNT_ONCHAIN,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT,MAX_NODE_PAIR_COUNT,MAX_CONSENSUS_REPOSITORIES_COUNT,USER_DEFINED_PERM_INDEX_START,MAX_PERM_FOR_ENTITY,MAX_ADMIN_COUNT,MAX_ITEM_COUNT,ROLE_OWNER,ROLE_ADMIN,ROLE_ENTITY,MAX_AGENT_COUNT,MAX_DISPUTE_COUNT,MAX_SHARING_COUNT,MAX_VOTING_GUARD_COUNT,MAX_POLICY_COUNT,MAX_ID_COUNT_ONCE,MAX_REWARD_COUNT,MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD,MAX_CONTEXT_REPOSITORY_COUNT,MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_IM_COUNT,MAX_TAGS_COUNT,MAX_RECIPIENT_COUNT,MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT,WITHDRAW_DURATION_TIME,MAX_INDEMNITY_MULTIPLE,MAX_PRESENTER_COUNT,MAX_INPUT_SIZE,MAX_TABLE_SIZE,MAX_DEPENDED_COUNT,MAX_DISCOUNT_TOTAL_COUNT,MAX_USER_IDENTIFIER,MAX_ADDRESS_COUNT,MAX_RECORD_LENGTH,MAX_OBJECTION_ROUNDS,BRIDGE_MESSAGE_VERSION,BRIDGE_EVM_ADDRESS_LENGTH,BRIDGE_CURRENT_VERSION,BRIDGE_TRANSFER_STATUS_PENDING,BRIDGE_TRANSFER_STATUS_APPROVED,BRIDGE_TRANSFER_STATUS_CLAIMED,BRIDGE_TRANSFER_STATUS_NOT_FOUND};export{REGISTRAR_ADDRESS,ENTITY_OBJECT_ADDRESS};export const TASK_BINDING_SLOT=0xfe;export const ONCE_SLOT_BYTES=0xff;export const ONCHAIN_CONSTANT_MCP_CONSUMERS={'MAX_NODE_COUNT':['machine\x20topology\x20limits\x20check','machine\x20design\x20review\x20R-M1-07','machine\x20translation\x20review\x20MC-C-01','knowledge\x20index\x20(max_node_count\x20field)'],'MAX_FORWARD_ORDER_COUNT':[],'MAX_NODE_PAIR_COUNT':['machine\x20topology\x20limits\x20check'],'USER_DEFINED_PERM_INDEX_START':['machine\x20design\x20review\x20R-M3-08','guard\x20risk\x20review\x20(forward\x20permissionIndex\x20guidance)'],'MAX_VOTING_GUARD_COUNT':['arbitration\x20score\x20evaluation\x20(fairness_governance\x20reason)'],'MAX_ITEM_COUNT':['permission\x20context\x20builder\x20(entity_permission\x20reverse\x20index)'],'ROLE_OWNER':['permission\x20context\x20builder\x20(entity_permission\x20role\x20flags)'],'ROLE_ADMIN':['permission\x20context\x20builder\x20(entity_permission\x20role\x20flags)'],'ROLE_ENTITY':['permission\x20context\x20builder\x20(entity_permission\x20role\x20flags)']};export function getOnchainConstant(a){const b=ONCHAIN_CONSTANTS[a];if(b===undefined)throw new Error('Unknown\x20on-chain\x20constant:\x20'+String(a));return b;}
|
|
1
|
+
import{ONCHAIN_CONSTANTS,MAX_NODE_COUNT,MAX_NODE_COUNT_ONCHAIN,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT,MAX_NODE_PAIR_COUNT,MAX_CONSENSUS_REPOSITORIES_COUNT,USER_DEFINED_PERM_INDEX_START,MAX_PERM_FOR_ENTITY,MAX_ADMIN_COUNT,MAX_ITEM_COUNT,ROLE_OWNER,ROLE_ADMIN,ROLE_ENTITY,MAX_AGENT_COUNT,MAX_DISPUTE_COUNT,MAX_SHARING_COUNT,MAX_VOTING_GUARD_COUNT,MAX_POLICY_COUNT,MAX_ID_COUNT_ONCE,MAX_REWARD_COUNT,MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD,MAX_CONTEXT_REPOSITORY_COUNT,MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_IM_COUNT,MAX_TAGS_COUNT,MAX_RECIPIENT_COUNT,MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT,MAX_OBJECTION_ROUNDS,WITHDRAW_DURATION_TIME,MAX_ADDRESS_COUNT,MAX_RECORD_LENGTH,BRIDGE_MESSAGE_VERSION,BRIDGE_EVM_ADDRESS_LENGTH,BRIDGE_CURRENT_VERSION,BRIDGE_TRANSFER_STATUS_PENDING,BRIDGE_TRANSFER_STATUS_APPROVED,BRIDGE_TRANSFER_STATUS_CLAIMED,BRIDGE_TRANSFER_STATUS_NOT_FOUND,MAX_INDEMNITY_MULTIPLE,MAX_PRESENTER_COUNT,MAX_INPUT_SIZE,MAX_TABLE_SIZE,MAX_DEPENDED_COUNT,MAX_DISCOUNT_TOTAL_COUNT,MAX_USER_IDENTIFIER}from'@wowok/wowok';import{REGISTRAR_ADDRESS,ENTITY_OBJECT_ADDRESS}from'@wowok/wowok';export{ONCHAIN_CONSTANTS,MAX_NODE_COUNT,MAX_NODE_COUNT_ONCHAIN,MAX_FORWARD_COUNT,MAX_FORWARD_ORDER_COUNT,MAX_NODE_PAIR_COUNT,MAX_CONSENSUS_REPOSITORIES_COUNT,USER_DEFINED_PERM_INDEX_START,MAX_PERM_FOR_ENTITY,MAX_ADMIN_COUNT,MAX_ITEM_COUNT,ROLE_OWNER,ROLE_ADMIN,ROLE_ENTITY,MAX_AGENT_COUNT,MAX_DISPUTE_COUNT,MAX_SHARING_COUNT,MAX_VOTING_GUARD_COUNT,MAX_POLICY_COUNT,MAX_ID_COUNT_ONCE,MAX_REWARD_COUNT,MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD,MAX_CONTEXT_REPOSITORY_COUNT,MAX_NAMED_OPERATOR_COUNT,MAX_NAMED_OPERATOR_ADDRESS_COUNT,MAX_IM_COUNT,MAX_TAGS_COUNT,MAX_RECIPIENT_COUNT,MAX_PROPOSITION_COUNT,MAX_VOTOR_COUNT,WITHDRAW_DURATION_TIME,MAX_INDEMNITY_MULTIPLE,MAX_PRESENTER_COUNT,MAX_INPUT_SIZE,MAX_TABLE_SIZE,MAX_DEPENDED_COUNT,MAX_DISCOUNT_TOTAL_COUNT,MAX_USER_IDENTIFIER,MAX_ADDRESS_COUNT,MAX_RECORD_LENGTH,MAX_OBJECTION_ROUNDS,BRIDGE_MESSAGE_VERSION,BRIDGE_EVM_ADDRESS_LENGTH,BRIDGE_CURRENT_VERSION,BRIDGE_TRANSFER_STATUS_PENDING,BRIDGE_TRANSFER_STATUS_APPROVED,BRIDGE_TRANSFER_STATUS_CLAIMED,BRIDGE_TRANSFER_STATUS_NOT_FOUND};export{REGISTRAR_ADDRESS,ENTITY_OBJECT_ADDRESS};export const TASK_BINDING_SLOT=0xfe;export const ONCE_SLOT_BYTES=0xff;export function declaresTaskBindingSlot(a){if(!Array['isArray'](a))return![];return a['some'](b=>{if(typeof b!=='object'||b===null)return![];const c=b;return Number(c['identifier'])===TASK_BINDING_SLOT&&c['b_submission']===!![]&&String(c['value_type'])==='Address';});}export function callerIndependentSlots(a){if(!Array['isArray'](a))return[];const b=[];for(const c of a){if(typeof c!=='object'||c===null)continue;const d=c,e=Number(d['identifier']);if(!Number['isFinite'](e)||b['includes'](e))continue;if(d['b_submission']!==!![]||e===TASK_BINDING_SLOT)b['push'](e);}return b;}export const ONCHAIN_CONSTANT_MCP_CONSUMERS={'MAX_NODE_COUNT':['machine\x20topology\x20limits\x20check','machine\x20design\x20review\x20R-M1-07','machine\x20translation\x20review\x20MC-C-01','knowledge\x20index\x20(max_node_count\x20field)'],'MAX_FORWARD_ORDER_COUNT':[],'MAX_NODE_PAIR_COUNT':['machine\x20topology\x20limits\x20check'],'USER_DEFINED_PERM_INDEX_START':['machine\x20design\x20review\x20R-M3-08','guard\x20risk\x20review\x20(forward\x20permissionIndex\x20guidance)'],'MAX_VOTING_GUARD_COUNT':['arbitration\x20score\x20evaluation\x20(fairness_governance\x20reason)'],'MAX_ITEM_COUNT':['permission\x20context\x20builder\x20(entity_permission\x20reverse\x20index)'],'ROLE_OWNER':['permission\x20context\x20builder\x20(entity_permission\x20role\x20flags)'],'ROLE_ADMIN':['permission\x20context\x20builder\x20(entity_permission\x20role\x20flags)'],'ROLE_ENTITY':['permission\x20context\x20builder\x20(entity_permission\x20role\x20flags)']};export function getOnchainConstant(a){const b=ONCHAIN_CONSTANTS[a];if(b===undefined)throw new Error('Unknown\x20on-chain\x20constant:\x20'+String(a));return b;}
|
|
@@ -43,6 +43,29 @@ export interface ParamSchemaSource {
|
|
|
43
43
|
}[];
|
|
44
44
|
}
|
|
45
45
|
export declare function paramSchema(t: ParamSchemaSource): ParamSchemaRow[];
|
|
46
|
+
export interface UserInputSpecSource {
|
|
47
|
+
fee_params: Record<string, number | string>;
|
|
48
|
+
conditional_guards?: {
|
|
49
|
+
param: string;
|
|
50
|
+
values?: string[];
|
|
51
|
+
}[];
|
|
52
|
+
user_input_specs?: readonly {
|
|
53
|
+
question: string;
|
|
54
|
+
param_key: string;
|
|
55
|
+
note?: string;
|
|
56
|
+
}[];
|
|
57
|
+
}
|
|
58
|
+
export interface UserInputQuestion {
|
|
59
|
+
question: string;
|
|
60
|
+
param_key: string;
|
|
61
|
+
note?: string;
|
|
62
|
+
default: number | string;
|
|
63
|
+
unit_hint: string;
|
|
64
|
+
meaning: string;
|
|
65
|
+
bounds?: ParamBounds;
|
|
66
|
+
allowed: string[];
|
|
67
|
+
}
|
|
68
|
+
export declare function resolveUserInputQuestions(t: UserInputSpecSource): UserInputQuestion[];
|
|
46
69
|
export type SchemaCompatibleRow = ParamSchemaRow | ParamRow;
|
|
47
70
|
export interface ParamMatch<T> {
|
|
48
71
|
row: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{classifyFeeParam}from'./param-tiers.js';export const PARAM_TAGS=['pricing','deposit','payout','settlement','window','cancel','return','review','dispute','logistics','membership','capacity','flow','staff','risk','growth','compliance'];const TAG_SET=new Set(PARAM_TAGS),TAG_RULES=[['pricing',/(_bps$|_price$|_usd$|_amount$|^min_|_fee$|_fee_|_cost$|^commission|^attributed_|^offsite_|^base_commission)/],['deposit',/(deposit|_floor_|escrow|prepay|balance_)/],['payout',/(payout|release|settle|settlement|remit)/],['settlement',/(settle|settlement|_release_|monthly_rent|threshold|commission|service_fee|_share_bps|retain_bps|_tip_bps)/],['window',/(_hours$|_days$|_ms$|_window$|_timeout|_deadline|_period|_grace|_term_|_nights$|_lead_)/],['cancel',/(cancel|withdraw|expire|no_show|no_fault)/],['return',/(return|refund|restock|replenish)/],['review',/(review|rating|reward|revision)/],['dispute',/(dispute|arbit|appeal|claim|triage|objection|defect_report)/],['logistics',/(ship|deliver|transit|pickup|dropoff|courier|dispatch|fulfil|handover|meet|auto_confirm|processing_time|production_lead)/],['membership',/(member|subscription|period_days|renewal|tier|quota)/],['capacity',/(_count$|_sessions$|_months$|_nights$|_allocators$|_rounds|_segment|_term_|_quota)/],['flow',/(_mode$|_line$|_type$|_policy$|_tier|_variant$|^storefront|^deposit_exit|^logistics|^crowdfunding|^installment|^acceptance|^after_sales)/],['staff',/(staff|operator|agent|role|permission|collaborator|roster)/],['risk',/(cap|_pool$|indemnity|penalty|forfeit|bond|guarantee|insurance)/],['growth',/(affiliate|referral|bounty|reward|promo|voucher|coupon|attributed_|offsite_)/],['compliance',/(privacy|consent|disclosure|age|kyc|passport|license|required_info)/]];export function tagsFor(a){const b=[];for(const [c,d]of TAG_RULES)if(d['test'](a))b['push'](c);return b;}const UNIT_BY_SUFFIX=[['_bps','bps'],['_usd','usd'],['_ms','ms'],['_hours','hours'],['_days','days'],['_months','months'],['_nights','nights'],['_count','count'],['_rounds','count'],['_sessions','count'],['_allocators','count']];export function unitFor(a){for(const [b,c]of UNIT_BY_SUFFIX)if(a['endsWith'](b))return c;return'unitless';}const UNIT_HINTS={'bps':'basis\x20points\x20(100\x20bps\x20=\x201%)','usd':'US\x20dollars','ms':'milliseconds','hours':'hours','days':'days','months':'months','nights':'nights','count':'a\x20whole\x20number','unitless':'a\x20plain\x20number','mist':'raw\x20amount\x20in\x20MIST\x20(1\x20WOW\x20=\x2010^9\x20MIST)'};export function unitHint(a){return UNIT_HINTS[a]??UNIT_HINTS['unitless'];}const PARAM_MEANINGS={'acceptance_timeout_hours':'Hours\x20the\x20supplier\x20has\x20to\x20accept\x20an\x20order\x20before\x20it\x20lapses.','allocator_threshold':'Formula\x20the\x20settlement\x20threshold\x20must\x20satisfy\x20(prose\x20directive,\x20not\x20a\x20setting).','annual_plan_usd':'Annual\x20membership\x20price\x20in\x20USD.','appeal_window_days':'Days\x20after\x20a\x20ruling\x20during\x20which\x20it\x20can\x20still\x20be\x20appealed.','arb_indemnity_floor_bps':'Floor,\x20in\x20basis\x20points\x20of\x20the\x20escrow,\x20reserved\x20for\x20arbitrator\x20compensation.','arb_payout_pairing':'How\x20a\x20buyer-won\x20ruling\x20combines\x20the\x20principal\x20refund\x20with\x20the\x20compensation:\x20\x27either\x27\x20pays\x20one\x20and\x20closes\x20the\x20other\x20rail,\x20\x27stacked\x27\x20pays\x20both\x20(the\x20stacked\x20money\x20rail\x20is\x20declared\x20only,\x20so\x20the\x20escrow\x20still\x20settles\x20under\x20\x27either\x27).','arbitration_fee_usd':'Flat\x20USD\x20fee\x20charged\x20to\x20open\x20an\x20arbitration\x20case.','attributed_commission_rate_bps':'Take\x20rate\x20charged\x20on\x20sales\x20traced\x20to\x20an\x20attributed\x20channel.','auto_confirm_days':'Days\x20of\x20buyer\x20silence\x20after\x20delivery\x20before\x20the\x20order\x20auto-completes\x20and\x20settlement\x20opens.','auto_confirm_hours':'Hours\x20of\x20buyer\x20silence\x20after\x20delivery\x20before\x20the\x20order\x20auto-completes.','balance_amount':'Remaining\x20amount\x20collected\x20in\x20the\x20balance\x20stage\x20(deposit\x20plus\x20balance\x20pricing).','balance_window_days':'Days\x20the\x20buyer\x20has\x20to\x20pay\x20the\x20remaining\x20balance\x20after\x20the\x20deposit.','base_commission_rate_bps':'Base\x20take\x20rate\x20before\x20channel-attribution\x20adjustments.','bounty_high_hunter_bps':'Hunter\x27s\x20share\x20of\x20the\x20high-severity\x20bounty\x20pool,\x20in\x20basis\x20points;\x20the\x20sponsoring\x20company\x20receives\x20the\x20complement\x20(10000\x20minus\x20this).','bounty_medium_hunter_bps':'Hunter\x27s\x20share\x20of\x20the\x20medium-severity\x20bounty\x20pool,\x20in\x20basis\x20points;\x20the\x20sponsoring\x20company\x20receives\x20the\x20complement\x20(10000\x20minus\x20this).','bounty_low_hunter_bps':'Hunter\x27s\x20share\x20of\x20the\x20low-severity\x20bounty\x20pool,\x20in\x20basis\x20points;\x20the\x20sponsoring\x20company\x20receives\x20the\x20complement\x20(10000\x20minus\x20this).','campaign_deadline_ms':'Unix\x20epoch\x20milliseconds\x20at\x20which\x20the\x20campaign\x20closes.\x20Generation\x20DERIVES\x20it\x20from\x20campaign_duration_days\x20when\x20the\x20operator\x20answered\x20the\x20length\x20(build\x20instant\x20+\x20N\x20days,\x20recorded\x20on\x20the\x20plan);\x20pass\x20it\x20directly\x20only\x20when\x20the\x20close\x20date\x20is\x20fixed.','campaign_duration_days':'Running\x20days\x20from\x20launch\x20to\x20campaign\x20close.\x20The\x20unit\x20the\x20operator\x20answers\x20in;\x20generation\x20converts\x20it\x20into\x20the\x20absolute\x20campaign_deadline_ms\x20every\x20chain\x20deadline\x20gate\x20reads.','cancel_tier_1_boundary_hours':'Notice\x20before\x20the\x20service\x20start\x20at\x20which\x20tier\x201\x20begins,\x20in\x20hours\x20(cancelling\x20further\x20out\x20pays\x20the\x20tier-1\x20charge).','cancel_tier_2_boundary_hours':'Notice\x20before\x20the\x20service\x20start\x20at\x20which\x20tier\x202\x20begins,\x20in\x20hours.','cancel_tier_3_boundary_hours':'Notice\x20before\x20the\x20service\x20start\x20at\x20which\x20tier\x203\x20(the\x20no-show\x20band)\x20begins,\x20in\x20hours.','cancel_tier_1_charge_bps':'Cancellation\x20charge\x20for\x20the\x20earliest\x20band\x20(most\x20notice),\x20in\x20basis\x20points\x20of\x20the\x20order\x20amount;\x20the\x20buyer\x20is\x20refunded\x20the\x20complement.','cancel_tier_2_charge_bps':'Cancellation\x20charge\x20for\x20the\x20middle-early\x20band,\x20in\x20basis\x20points\x20of\x20the\x20order\x20amount;\x20the\x20buyer\x20is\x20refunded\x20the\x20complement.','cancel_tier_3_charge_bps':'Cancellation\x20charge\x20for\x20the\x20middle-late\x20band,\x20in\x20basis\x20points\x20of\x20the\x20order\x20amount;\x20the\x20buyer\x20is\x20refunded\x20the\x20complement.','cancel_tier_4_charge_bps':'Cancellation\x20charge\x20for\x20the\x20last-minute\x20(no-show)\x20band,\x20in\x20basis\x20points\x20of\x20the\x20order\x20amount;\x20the\x20buyer\x20is\x20refunded\x20the\x20complement.','service_start_ms':'Unix\x20epoch\x20milliseconds\x20of\x20the\x20service/departure\x20start,\x20shared\x20by\x20every\x20order\x20of\x20that\x20service;\x20the\x20cancellation\x20bands\x20measure\x20notice\x20against\x20it.','cancellation_policy':'Prose\x20cancellation\x20policy;\x20the\x20enforceable\x20values\x20are\x20the\x20cancel-window\x20keys.','claim_window_days':'Days\x20after\x20delivery\x20in\x20which\x20the\x20buyer\x20can\x20file\x20a\x20dispute\x20before\x20settlement\x20opens.','claim_window_hours':'Hours\x20of\x20the\x20dispute-filing\x20window\x20after\x20delivery.','co_holder_bps':'Share,\x20in\x20basis\x20points,\x20held\x20by\x20a\x20co-holder\x20of\x20the\x20asset\x20or\x20right.','commission_rate_bps':'Platform\x20take\x20rate\x20per\x20settled\x20order,\x20in\x20basis\x20points\x20(0\x20keeps\x20the\x20merchant\x20the\x20full\x20amount).','confirm_timeout_hours':'Hours\x20the\x20merchant\x20has\x20to\x20confirm\x20an\x20order\x20before\x20it\x20auto-cancels.','confirm_window_hours':'Window,\x20in\x20hours,\x20for\x20confirming\x20the\x20order\x20or\x20handover.','contract_fee_large_usd':'Flat\x20contract\x20fee\x20for\x20large\x20engagements.','contract_fee_small_usd':'Flat\x20contract\x20fee\x20for\x20small\x20engagements.','contract_fee_tier_boundary_usd':'Contract\x20value,\x20in\x20USD,\x20separating\x20the\x20small\x20from\x20the\x20large\x20fee\x20tier.','courier_fee':'Courier\x20delivery\x20fee.','courier_tip_bps':'Rider\x20tip\x20or\x20incentive,\x20in\x20basis\x20points\x20of\x20the\x20order\x20value.','course_price_usd':'Price\x20of\x20one\x20course\x20seat\x20in\x20USD.','creator_settlement_retain_bps':'Share\x20of\x20each\x20settlement\x20the\x20creator\x20keeps\x20(the\x20rest\x20funds\x20platform\x20and\x20fee\x20legs).','damage_max_amount':'Maximum\x20damage\x20compensation\x20payable\x20out\x20of\x20the\x20escrow.','defect_report_window_hours':'Hours\x20after\x20delivery\x20in\x20which\x20a\x20defect\x20or\x20damage\x20must\x20be\x20reported.','delivery_window_days':'Promised\x20delivery\x20window\x20in\x20days.','deposit_amount':'Up-front\x20deposit\x20collected\x20at\x20order\x20time\x20(the\x20rest\x20is\x20collected\x20later).','deposit_exit_policy':'Prose\x20policy\x20for\x20exiting\x20or\x20refunding\x20the\x20deposit.','deposit_refund_days':'Days\x20after\x20checkout\x20within\x20which\x20the\x20deposit\x20is\x20refunded.','digital_product_fee_bps':'Fee\x20rate\x20charged\x20on\x20digital\x20product\x20sales.','digital_product_fee_max_usd':'Cap\x20on\x20the\x20digital\x20product\x20fee,\x20in\x20USD.','digital_product_fee_min_usd':'Floor\x20on\x20the\x20digital\x20product\x20fee,\x20in\x20USD.','dispute_timeout_days':'Days\x20after\x20a\x20dispute\x20is\x20filed\x20before\x20it\x20escalates\x20or\x20defaults.','dispute_window_days':'Days\x20after\x20delivery\x20to\x20escalate\x20a\x20complaint\x20to\x20arbitration.','early_exit_penalty_amount':'Flat\x20penalty\x20charged\x20on\x20early\x20termination.','early_exit_penalty_months':'Months\x20of\x20rent\x20charged\x20as\x20the\x20early-exit\x20penalty.','errand_line':'Errand\x20service\x20line;\x20this\x20selector\x20changes\x20which\x20rails\x20the\x20machine\x20installs.','escrow_release_days':'Days\x20the\x20escrow\x20holds\x20before\x20the\x20funds\x20release\x20to\x20the\x20merchant.','evaluation_window_days':'Days\x20allowed\x20to\x20evaluate\x20a\x20submitted\x20deliverable.','evidence_window_hours':'Hours\x20to\x20submit\x20evidence\x20once\x20a\x20dispute\x20is\x20open.','free_cancel_hours':'Hours\x20after\x20purchase\x20during\x20which\x20cancellation\x20is\x20free\x20(full\x20refund).','full_price':'List\x20price\x20before\x20discounts\x20or\x20the\x20deposit\x20split.','funding_threshold':'Amount\x20that\x20must\x20be\x20raised\x20for\x20the\x20campaign\x20to\x20succeed.','grace_days':'Grace\x20period\x20in\x20days\x20before\x20a\x20late\x20payment\x20counts\x20as\x20a\x20breach.','host_rate_bps':'Host\x20payout\x20share\x20of\x20the\x20booking\x20value,\x20in\x20basis\x20points.','incumbent_take_bps':'Take\x20rate\x20of\x20the\x20incumbent\x20platform\x20(comparison\x20only).','inspection_deadline_hours':'Hours\x20to\x20complete\x20the\x20inspection\x20after\x20handover.','inspection_window_days':'Days\x20of\x20inspection\x20window\x20after\x20delivery.','instant_cancel_hours':'Hours\x20within\x20which\x20cancellation\x20takes\x20effect\x20immediately.','institution_share_bps':'Share\x20of\x20course\x20revenue\x20paid\x20to\x20the\x20institution.','kill_fee_bps':'Fee\x20kept\x20from\x20the\x20escrow\x20when\x20the\x20buyer\x20cancels\x20after\x20acceptance.','kill_fee_buyer_bps':'Late-cancellation\x20fee\x20charged\x20to\x20the\x20buyer.','layer2_segment_amounts':'Segment\x20amounts\x20of\x20the\x20second\x20allocation\x20layer\x20(directive\x20formula).','leader_commission_bps':'Commission\x20paid\x20to\x20the\x20group\x20leader\x20on\x20each\x20member\x20order.','lease_months':'Lease\x20length\x20in\x20months.','max_months':'Longest\x20subscription\x20or\x20lease\x20term,\x20in\x20months.','max_sessions':'Maximum\x20sessions\x20included\x20in\x20the\x20plan.','membership_price':'Membership\x20price\x20per\x20period.','merchant_service_fee_bps':'Incumbent\x20marketplace\x27s\x20merchant-side\x20service\x20fee\x20(benchmark,\x20comparison\x20only).\x20WoWok\x20is\x20DIRECT\x20SALES\x20here:\x20this\x20store\x20pays\x20no\x20platform\x20commission,\x20so\x20the\x20shipped\x20value\x20is\x200\x20and\x20no\x20money\x20rail\x20reads\x20it\x20—\x20set\x20it\x20only\x20if\x20YOU\x20are\x20the\x20aggregator\x20charging\x20your\x20own\x20sellers.','min_balance':'Minimum\x20balance\x20that\x20must\x20remain\x20(directive\x20floor).','min_booking_amount':'Minimum\x20bookable\x20amount\x20(directive\x20floor).','min_contract_usd':'Minimum\x20contract\x20value\x20in\x20USD\x20(directive\x20floor).','min_course_price_usd':'Minimum\x20course\x20price\x20in\x20USD\x20(directive\x20floor).','min_monthly_rent_usd':'Minimum\x20monthly\x20rent\x20in\x20USD\x20(directive\x20floor).','min_order_price':'Minimum\x20order\x20price\x20(directive\x20floor).','min_sku_price':'Minimum\x20SKU\x20price\x20(directive\x20floor).','min_term_price':'Minimum\x20price\x20per\x20term:\x20the\x20numeric\x20floor\x20the\x20settlement\x20fixed\x20legs\x20must\x20fit\x20under\x20(per-session\x20releases\x20count\x20the\x20whole\x20term).','min_term_price_usd':'Minimum\x20price\x20per\x20term\x20in\x20USD\x20(directive\x20floor).','max_discount_bps':'Ceiling\x20on\x20any\x20coupon\x20the\x20merchant\x20may\x20issue\x20against\x20this\x20shape,\x20in\x20basis\x20points\x20—\x20derived\x20from\x20how\x20much\x20the\x20fixed\x20legs\x20leave\x20above\x20the\x20price\x20floor.','month_release_day':'Day\x20of\x20the\x20month\x20on\x20which\x20the\x20monthly\x20release\x20runs.','monthly_allocators':'Monthly\x20allocators\x20to\x20open,\x20one\x20per\x20release\x20period.','monthly_rent_amount':'Monthly\x20rent\x20amount.','no_fault_exit_days':'Days\x20of\x20notice\x20required\x20for\x20a\x20no-fault\x20exit.','no_show_floor_hours':'Hours\x20after\x20which\x20a\x20no-show\x20releases\x20the\x20slot\x20with\x20a\x20floor\x20charge.','objection_window_hours':'Hours\x20to\x20object\x20after\x20a\x20proposal\x20or\x20claim.','offsite_ads_rate_bps':'Take\x20rate\x20on\x20off-site\x20advertising-attributed\x20sales.','partner_share_bps':'Share\x20of\x20revenue\x20paid\x20to\x20the\x20partner.','payment_fee_bps':'Payment\x20processing\x20fee\x20in\x20basis\x20points.','per_session_release':'Amount\x20released\x20per\x20completed\x20session.','period_days':'Length\x20of\x20one\x20billing\x20period\x20in\x20days.','pickup_window_hours':'Hours\x20within\x20which\x20pickup\x20must\x20be\x20completed.','platform_commission_bps':'Platform\x20take\x20rate\x20per\x20settled\x20order,\x20in\x20basis\x20points\x20(0\x20keeps\x20the\x20merchant\x20the\x20full\x20amount).','platform_commission_rate_bps':'Platform\x20take\x20rate\x20per\x20settled\x20order,\x20in\x20basis\x20points.','platform_fee_rate_bps':'Platform\x20fee\x20rate\x20applied\x20to\x20the\x20order\x20value,\x20in\x20basis\x20points.','platform_rate_bps':'Platform\x20rate\x20applied\x20to\x20the\x20order\x20value,\x20in\x20basis\x20points.','platform_rate_cap_bps':'Upper\x20bound\x20on\x20the\x20platform\x20take\x20rate.','platform_share_bps':'Share\x20of\x20the\x20order\x20kept\x20by\x20the\x20platform.','platform_take_bps':'Platform\x20take\x20per\x20settled\x20order,\x20in\x20basis\x20points.','platform_tool_fee_bps':'Fee\x20for\x20using\x20the\x20platform\x20tooling,\x20in\x20basis\x20points.','point_type':'Point\x20or\x20credit\x20type\x20used\x20by\x20the\x20loyalty\x20ledger.','preferred_property_rate_bps':'Commission\x20rate\x20applied\x20to\x20preferred\x20properties.','prepay_cap':'Cap\x20on\x20the\x20amount\x20that\x20may\x20be\x20prepaid.','primary_holder_bps':'Share\x20held\x20by\x20the\x20primary\x20rights\x20holder.','processing_time_days':'Days\x20the\x20supplier\x20takes\x20to\x20process\x20the\x20request.','producer_bps':'Share\x20paid\x20to\x20the\x20producer.','production_lead_days':'Days\x20needed\x20to\x20produce\x20the\x20item\x20before\x20it\x20ships.','property_rate_bps':'Commission\x20rate\x20on\x20property\x20bookings.','protection_cap_usd':'Maximum\x20buyer-protection\x20payout\x20in\x20USD.','publisher_bps':'Share\x20paid\x20to\x20the\x20publisher.','refund_window_days':'Days\x20after\x20delivery\x20in\x20which\x20a\x20refund\x20may\x20be\x20requested.','renewal_reminder_days':'Days\x20before\x20renewal\x20to\x20send\x20the\x20reminder.','required_info_enforcement':'Whether\x20missing\x20required\x20buyer\x20info\x20blocks\x20the\x20order\x20(on/off).','requirements_timeout_hours':'Hours\x20the\x20buyer\x20has\x20to\x20supply\x20missing\x20requirements\x20before\x20the\x20order\x20lapses.','response_timeout_hours':'Hours\x20a\x20seller\x20has\x20to\x20grant\x20or\x20decline\x20a\x20cancel\x20request\x20before\x20a\x20keeper\x20auto-cancels\x20it\x20in\x20the\x20buyer\x27s\x20favour\x20(full\x20refund).','reserve_days':'Days\x20a\x20reserve\x20is\x20held\x20back\x20from\x20the\x20payout.','restock_confirm_days':'Days\x20to\x20confirm\x20restocking\x20after\x20a\x20return\x20arrives.','restock_on_refund':'Restock\x20rule\x20applied\x20when\x20a\x20refund\x20completes\x20(directive).','return_notice_days':'Days\x20of\x20notice\x20required\x20before\x20returning\x20the\x20item.','return_transit_days':'Days\x20allowed\x20for\x20the\x20returned\x20item\x20to\x20travel\x20back.','return_window_days':'Days\x20after\x20delivery\x20in\x20which\x20the\x20buyer\x20may\x20return\x20the\x20item.','return_window_hours':'Hours\x20after\x20delivery\x20in\x20which\x20the\x20buyer\x20may\x20return\x20the\x20item.','review_reward_per_claim':'Bounty\x20paid\x20for\x20one\x20accepted\x20review\x20claim.','review_reward_pool':'Total\x20pool\x20that\x20funds\x20review\x20rewards.','review_window_days':'Days\x20after\x20completion\x20in\x20which\x20a\x20review\x20may\x20be\x20submitted.','revision_rounds_max':'Maximum\x20revision\x20rounds\x20included\x20in\x20the\x20price.','reward_claim_closes_after_days':'Days\x20after\x20completion\x20when\x20the\x20review-reward\x20claim\x20closes.','reward_claim_opens_after_days':'Days\x20after\x20the\x20after-sales\x20window\x20before\x20the\x20review-reward\x20bounty\x20becomes\x20claimable.','segment_count':'Number\x20of\x20allocation\x20segments.','service_fee_rate_bps':'Service\x20fee\x20rate\x20charged\x20on\x20the\x20order.','session_count':'Number\x20of\x20sessions\x20included\x20in\x20the\x20plan.','settle_hours':'Hours\x20after\x20the\x20settlement\x20window\x20opens\x20before\x20funds\x20reach\x20the\x20merchant.','settlement_days':'Days\x20between\x20order\x20completion\x20and\x20settlement\x20to\x20the\x20merchant.','settlement_delay_days':'Delay\x20in\x20days\x20applied\x20to\x20the\x20payout.','setting_lock_days':'Days\x20during\x20which\x20a\x20setting\x20is\x20locked\x20after\x20the\x20order\x20is\x20placed.','stay_nights':'Nights\x20per\x20stay.','storefront_mode':'Storefront\x20shape;\x20this\x20selector\x20changes\x20the\x20generated\x20storefront\x20topology.','submission_window_days':'Days\x20to\x20submit\x20the\x20deliverable.','subscription_monthly_usd':'Monthly\x20subscription\x20price\x20in\x20USD.','term_count':'Number\x20of\x20terms\x20or\x20invoices\x20in\x20the\x20contract.','term_price':'Price\x20charged\x20per\x20term.','term_price_usd':'Price\x20charged\x20per\x20term\x20in\x20USD.','threshold':'Escrow\x20amount\x20that\x20triggers\x20the\x20next\x20stage.','tier5_guest_bps':'Cancellation\x20tier\x205:\x20share\x20charged\x20to\x20the\x20guest.','tier5_host_bps':'Cancellation\x20tier\x205:\x20share\x20paid\x20to\x20the\x20host.','tier6_guest_bps':'Cancellation\x20tier\x206:\x20share\x20charged\x20to\x20the\x20guest.','tier6_host_bps':'Cancellation\x20tier\x206:\x20share\x20paid\x20to\x20the\x20host.','triage_window_days':'Days\x20to\x20triage\x20a\x20report\x20before\x20it\x20escalates.','tuition_usd':'Tuition\x20per\x20enrollment\x20in\x20USD.','unclaimed_exit':'What\x20happens\x20to\x20an\x20order\x20the\x20buyer\x20never\x20collects:\x20refund_buyer\x20(default)\x20returns\x20the\x20principal\x20in\x20full\x20after\x20the\x20pickup\x20window,\x20settle_merchant\x20opens\x20the\x20serial\x20claim\x20window\x20and\x20settles\x20to\x20the\x20supplier\x20with\x20the\x20buyer\x20keeping\x20a\x20late-appeal\x20refund\x20route.','withdrawal_window_days':'Days\x20during\x20which\x20withdrawal\x20is\x20allowed.'};export const CURATED_MEANING_COUNT=Object['keys'](PARAM_MEANINGS)['length'];const KIND_WORD={'money':'amount','ratio':'rate','duration':'duration','count':'count','enum':'option','flag':'on/off\x20switch','text':'text','list':'list\x20of\x20values'};export function paramMeaning(a,b,c,d){const e=PARAM_MEANINGS[a];if(e!==undefined)return e;const f=d['length']>0x0?'\x20on\x20the\x20'+d['join']('/')+'\x20facet':'';return'Not\x20yet\x20described\x20—\x20a\x20'+KIND_WORD[b]+(c!=='unitless'?'\x20in\x20'+c:'')+f+'.';}export const PARAM_ALIASES=[['take\x20rate',['platform_commission_bps','platform_commission_rate_bps','platform_take_bps','platform_fee_rate_bps','platform_rate_bps','commission_rate_bps','merchant_service_fee_bps','incumbent_take_bps']],['commission',['platform_commission_bps','commission_rate_bps','leader_commission_bps','attributed_commission_rate_bps']],['get\x20paid',['settle_hours','settlement_days','settlement_delay_days','escrow_release_days','month_release_day']],['payout',['settle_hours','settlement_days','settlement_delay_days','escrow_release_days','reserve_days']],['refund',['return_window_days','refund_window_days','deposit_refund_days','free_cancel_hours']],['cancel',['free_cancel_hours','instant_cancel_hours','kill_fee_bps','cancel_tier_1_charge_bps','cancel_tier_2_charge_bps','cancel_tier_3_charge_bps','cancel_tier_4_charge_bps']],['dispute',['claim_window_days','dispute_window_days','dispute_timeout_days','arbitration_fee_usd']],['deposit',['deposit_amount','balance_amount','prepay_cap']],['tip',['courier_tip_bps','courier_fee']],['reward',['review_reward_pool','review_reward_per_claim','reward_claim_opens_after_days','reward_claim_closes_after_days']],['bounty',['bounty_high_hunter_bps','bounty_medium_hunter_bps','bounty_low_hunter_bps']],['hunter\x20share',['bounty_high_hunter_bps','bounty_medium_hunter_bps','bounty_low_hunter_bps']],['review',['review_window_days','review_reward_per_claim','review_reward_pool']],['rent',['monthly_rent_amount','lease_months','early_exit_penalty_months']],['delivery',['delivery_window_days','courier_fee','pickup_window_hours']],['membership',['membership_price','subscription_monthly_usd','annual_plan_usd','period_days']],['commission\x20cap',['platform_rate_cap_bps','protection_cap_usd']],['fee',['arbitration_fee_usd','payment_fee_bps','courier_fee','platform_tool_fee_bps']],['how\x20much\x20do\x20i\x20keep',['platform_commission_bps','platform_take_bps','platform_share_bps','commission_rate_bps']],['late\x20fee',['kill_fee_bps','early_exit_penalty_months','cancel_tier_4_charge_bps']],['no\x20show',['no_show_floor_hours']],['holdback',['reserve_days','creator_settlement_retain_bps','setting_lock_days']],['minimum\x20order',['min_order_price','min_contract_usd','min_course_price_usd','min_booking_amount','min_sku_price']],['campaign\x20length',['campaign_duration_days']],['arbitration\x20fee',['arbitration_fee_usd']],['dispute\x20window',['dispute_window_days','dispute_timeout_days','claim_window_days']],['late\x20delivery',['delivery_window_days','auto_confirm_days','auto_confirm_hours']],['plan\x20price',['subscription_monthly_usd','annual_plan_usd','membership_price']],['renewal\x20reminder',['renewal_reminder_days']],['shipping\x20deadline',['processing_time_days','delivery_window_days']],['down\x20payment',['deposit_amount','balance_amount','deposit_refund_days']],['balance\x20due',['balance_amount','balance_window_days']],['notice\x20period',['return_notice_days','no_fault_exit_days','early_exit_penalty_months']],['guest\x20count',['tier5_guest_bps','tier6_guest_bps']],['tiered\x20pricing',['tier5_guest_bps','tier6_guest_bps']],['cancellation\x20charge',['cancel_tier_1_charge_bps','cancel_tier_2_charge_bps','cancel_tier_3_charge_bps','cancel_tier_4_charge_bps']],['money\x20released',['settle_hours','settlement_days','settlement_delay_days','escrow_release_days','month_release_day','reserve_days']],['release\x20the\x20money',['settle_hours','settlement_days','settlement_delay_days','escrow_release_days','month_release_day','reserve_days']]];const MAX_BY_UNIT={'hours':{'max':0x2238,'hint':'0..8760\x20(one\x20year;\x200\x20=\x20unset)'},'days':{'max':0x16d,'hint':'0..365\x20(one\x20year;\x200\x20=\x20unset)'},'months':{'max':0x3c,'hint':'0..60\x20(five\x20years)'},'nights':{'max':0x16d,'hint':'0..365\x20nights'},'ms':{'max':0x3bb2cc3d800,'hint':'milliseconds;\x20absolute\x20deadlines\x20may\x20be\x20epoch\x20ms\x20(up\x20to\x20year\x202100)'},'count':{'max':0x186a0,'hint':'0\x20or\x20more,\x20whole\x20numbers'}},PARAM_RANGE_OVERRIDES={'stay_nights':{'min':0x1,'max':0x16d,'hint':'1..365\x20nights'},'period_days':{'min':0x1,'max':0x16e,'hint':'1..366\x20days\x20(a\x20monthly\x20period\x20is\x2030,\x20a\x20leap\x20year\x20366)'},'lease_months':{'min':0x1,'max':0x78,'hint':'1..120\x20months'},'max_months':{'min':0x1,'max':0x78,'hint':'1..120\x20months'},'month_release_day':{'min':0x1,'max':0x1f,'hint':'1..31\x20(a\x20day\x20of\x20the\x20month)'},'revision_rounds_max':{'min':0x0,'max':0x64,'hint':'0..100\x20rounds'}};export function boundsFor(a,b,c){if(a==='enum'||a==='flag'||a==='text'||a==='list')return undefined;if(b==='bps')return{'min':0x0,'max':0x2710,'hint':'0..10000\x20(100\x20bps\x20=\x201%)'};if(c!==undefined&&PARAM_RANGE_OVERRIDES[c]!==undefined)return PARAM_RANGE_OVERRIDES[c];if(a==='money')return{'min':0x0,'hint':'0\x20or\x20more'};const d=MAX_BY_UNIT[b];if(a==='count')return{'min':0x0,'max':MAX_BY_UNIT['count']['max'],'hint':MAX_BY_UNIT['count']['hint']};if(a==='duration'){if(d!==undefined)return{'min':0x0,'max':d['max'],'hint':d['hint']};return{'min':0x0,'hint':'0\x20or\x20more\x20in\x20the\x20row\x27s\x20unit\x20(0\x20=\x20unset)'};}return undefined;}export function kindFor(a,b,c,d){if(c)return'enum';if(typeof b==='string'){if(/^(on|off|true|false)$/i['test'](b))return'flag';if(/^\s*-?\d+(?:\.\d+)?(?:\s*\/\s*-?\d+(?:\.\d+)?)+\s*$/['test'](b))return'list';return'enum';}const e=unitFor(a);if(e==='usd')return'money';if(e==='bps')return'ratio';if(e==='hours'||e==='days'||e==='ms'||e==='months'||e==='nights')return'duration';if(e==='count')return'count';if(d['includes']('pricing')||/amount|price|pool|cap|threshold|fee|cost|rent|reward|_per_claim|_release$|_retain|_tip$|tuition|balance|prepay|_share/['test'](a))return'money';return'count';}export function paramSchema(a){const b=new Set((a['conditional_guards']??[])['map'](e=>e['param'])),d=new Map();for(const e of a['conditional_guards']??[]){if(e['values']===undefined)continue;const f=d['get'](e['param'])??[];for(const g of e['values'])if(!f['includes'](g))f['push'](g);d['set'](e['param'],f);}return Object['entries'](a['fee_params'])['map'](([h,i])=>{const j=b['has'](h),k=classifyFeeParam(h,i,j),l=tagsFor(h),m=kindFor(h,i,j,l),n=unitFor(h),o=m==='money'&&n==='unitless'?'mist':n;return{'key':h,'tier':k['tier'],'tier_name':k['tier_name'],'group':k['group'],'tags':l,'kind':m,'unit':o,'unit_hint':unitHint(o),'meaning':paramMeaning(h,m,o,l),'type':typeof i==='number'?'number':'string','default':i,'bounds':boundsFor(m,o,h),'allowed':d['get'](h)??[],'disclosure':k['disclosure'],'selector':j,'settable_by':'merchant'};})['sort']((h,i)=>h['tier']-i['tier']||h['key']['localeCompare'](i['key']));}const STOPWORDS=new Set(['the','a','an','of','for','to','how','what','is','my','can','i','set','and','in','on','do','per','each']),WORD_SYNONYMS={'shipping':'ship','shipment':'ship','shipped':'ship','delivery':'deliver','deliveries':'deliver','restocking':'restock','restocked':'restock','renewals':'renewal'};function singular(a){if(a['length']<=0x3)return a;if(a['endsWith']('ies'))return a['slice'](0x0,-0x3)+'y';if(/(?:ses|xes|zes|ches|shes)$/['test'](a))return a['slice'](0x0,-0x2);if(a['endsWith']('s')&&!a['endsWith']('ss'))return a['slice'](0x0,-0x1);return a;}function canon(a){return WORD_SYNONYMS[a]??WORD_SYNONYMS[singular(a)]??singular(a);}function tokens(a){return a['toLowerCase']()['split'](/[^a-z0-9]+/)['filter'](b=>b['length']>0x1&&!STOPWORDS['has'](b))['map'](canon);}function keyWords(a){return a['toLowerCase']()['split'](/[^a-z0-9]+/)['filter'](b=>b['length']>0x1)['map'](canon);}const MIN_SCORE=0x4;export function matchParams(a,b,c=0x5){const d=tokens(a);if(d['length']===0x0)return[];const e=d['every'](m=>TAG_SET['has'](m))&&!b['some'](m=>keyWords(m['key'])['some'](n=>d['includes'](n))),f=a['toLowerCase']()['replace'](/[^a-z0-9]+/g,'_'),g='\x20'+a['toLowerCase']()['replace'](/[^a-z0-9]+/g,'\x20')['trim']()+'\x20',h=g['trim']()['split']('\x20')[0x0]??'',i=new Set(),j=[];for(const [m,n]of PARAM_ALIASES){if(!g['includes']('\x20'+m+'\x20')&&!g['includes']('\x20'+m+'s\x20'))continue;if(!m['includes']('\x20')&&m!==h)continue;j['push'](m);for(const o of n)i['add'](o);}const l=[];for(const p of b){if(p['disclosure']==='hidden')continue;let r=0x0;const s=[],u=new Set(),v=keyWords(p['key']);(p['key']===f||f['includes'](p['key']))&&(r+=0xa,s['push']('key:'+p['key']));for(const w of d){(v['includes'](w)||p['key']['includes']('_'+w))&&(r+=0x3,u['add'](w),s['push']('key-word:'+w)),p['tags']['includes'](w)&&(r+=0x2,u['add'](w),s['push']('tag:'+w));}i['has'](p['key'])&&(r+=0x6,s['push'](...j['map'](x=>'alias:'+x)));e&&d['every'](x=>p['tags']['includes'](x))&&(r+=0x4,s['push']('facet:'+d['join']('+')));if(p['meaning']!==undefined){const x=p['meaning']['toLowerCase']();let y=0x0;for(const z of d){if(y>=0x2)break;if(u['has'](z))continue;x['includes'](z)&&(r+=0x1,y++,s['push']('meaning:'+z));}}if(r<MIN_SCORE)continue;l['push']({'row':p,'score':r+0x1,'reasons':[...new Set(s)]});}return e?l['sort']((A,B)=>A['row']['tier']-B['row']['tier']||B['score']-A['score']||A['row']['key']['localeCompare'](B['row']['key'])):l['sort']((A,B)=>B['score']-A['score']||A['row']['key']['localeCompare'](B['row']['key'])),l['slice'](0x0,c);}export function searchTemplates(a,b,c,d=0x8){const e=[];for(const f of b){for(const g of matchParams(a,c(f),0x2)){e['push']({'template':f['id'],'key':g['row']['key'],'tier':g['row']['tier'],'disclosure':g['row']['disclosure'],'score':g['score']});}}return e['sort']((h,i)=>i['score']-h['score']||h['template']['localeCompare'](i['template'])),e['slice'](0x0,d);}
|
|
1
|
+
import{classifyFeeParam}from'./param-tiers.js';export const PARAM_TAGS=['pricing','deposit','payout','settlement','window','cancel','return','review','dispute','logistics','membership','capacity','flow','staff','risk','growth','compliance'];const TAG_SET=new Set(PARAM_TAGS),TAG_RULES=[['pricing',/(_bps$|_price$|_usd$|_amount$|^min_|_fee$|_fee_|_cost$|^commission|^attributed_|^offsite_|^base_commission)/],['deposit',/(deposit|_floor_|escrow|prepay|balance_)/],['payout',/(payout|release|settle|settlement|remit)/],['settlement',/(settle|settlement|_release_|monthly_rent|threshold|commission|service_fee|_share_bps|retain_bps|_tip_bps)/],['window',/(_hours$|_days$|_ms$|_window$|_timeout|_deadline|_period|_grace|_term_|_nights$|_lead_)/],['cancel',/(cancel|withdraw|expire|no_show|no_fault)/],['return',/(return|refund|restock|replenish)/],['review',/(review|rating|reward|revision)/],['dispute',/(dispute|arbit|appeal|claim|triage|objection|defect_report)/],['logistics',/(ship|deliver|transit|pickup|dropoff|courier|dispatch|fulfil|handover|meet|auto_confirm|processing_time|production_lead)/],['membership',/(member|subscription|period_days|renewal|tier|quota)/],['capacity',/(_count$|_sessions$|_months$|_nights$|_allocators$|_rounds|_segment|_term_|_quota)/],['flow',/(_mode$|_line$|_type$|_policy$|_tier|_variant$|^storefront|^deposit_exit|^logistics|^crowdfunding|^installment|^acceptance|^after_sales)/],['staff',/(staff|operator|agent|role|permission|collaborator|roster)/],['risk',/(cap|_pool$|indemnity|penalty|forfeit|bond|guarantee|insurance)/],['growth',/(affiliate|referral|bounty|reward|promo|voucher|coupon|attributed_|offsite_)/],['compliance',/(privacy|consent|disclosure|age|kyc|passport|license|required_info)/]];export function tagsFor(a){const b=[];for(const [c,d]of TAG_RULES)if(d['test'](a))b['push'](c);return b;}const UNIT_BY_SUFFIX=[['_bps','bps'],['_usd','usd'],['_ms','ms'],['_hours','hours'],['_days','days'],['_months','months'],['_nights','nights'],['_count','count'],['_rounds','count'],['_sessions','count'],['_allocators','count']];export function unitFor(a){for(const [b,c]of UNIT_BY_SUFFIX)if(a['endsWith'](b))return c;return'unitless';}const UNIT_HINTS={'bps':'basis\x20points\x20(100\x20bps\x20=\x201%)','usd':'US\x20dollars','ms':'milliseconds','hours':'hours','days':'days','months':'months','nights':'nights','count':'a\x20whole\x20number','unitless':'a\x20plain\x20number','mist':'raw\x20amount\x20in\x20MIST\x20(1\x20WOW\x20=\x2010^9\x20MIST)'};export function unitHint(a){return UNIT_HINTS[a]??UNIT_HINTS['unitless'];}const PARAM_MEANINGS={'acceptance_timeout_hours':'Hours\x20the\x20supplier\x20has\x20to\x20accept\x20an\x20order\x20before\x20it\x20lapses.','after_sales_scope':'After-sales\x20money\x20scope\x20for\x20a\x20short/bad\x20delivery:\x20\x27full_refund\x27\x20(default)\x20refunds\x20the\x20whole\x20pledge\x20on\x20either\x20remedy\x20path;\x20\x27partial_refund\x27\x20refunds\x20in\x20full\x20only\x20when\x20goods\x20return\x20and\x20pays\x20the\x20declared\x20fixed\x20shortfall\x20compensation\x20on\x20the\x20refund-only\x20path.','allocator_threshold':'Formula\x20the\x20settlement\x20threshold\x20must\x20satisfy\x20(prose\x20directive,\x20not\x20a\x20setting).','annual_plan_usd':'Annual\x20membership\x20price\x20in\x20USD.','appeal_window_days':'Days\x20after\x20a\x20ruling\x20during\x20which\x20it\x20can\x20still\x20be\x20appealed.','arb_indemnity_floor_bps':'Floor,\x20in\x20basis\x20points\x20of\x20the\x20escrow,\x20reserved\x20for\x20arbitrator\x20compensation.','arb_payout_pairing':'How\x20a\x20buyer-won\x20ruling\x20combines\x20the\x20principal\x20refund\x20with\x20the\x20compensation:\x20\x27either\x27\x20pays\x20one\x20and\x20closes\x20the\x20other\x20rail,\x20\x27stacked\x27\x20pays\x20both\x20(the\x20stacked\x20money\x20rail\x20is\x20declared\x20only,\x20so\x20the\x20escrow\x20still\x20settles\x20under\x20\x27either\x27).','arbitration_fee_usd':'Flat\x20USD\x20fee\x20charged\x20to\x20open\x20an\x20arbitration\x20case.','attributed_commission_rate_bps':'Take\x20rate\x20charged\x20on\x20sales\x20traced\x20to\x20an\x20attributed\x20channel.','auto_confirm_days':'Days\x20of\x20buyer\x20silence\x20after\x20delivery\x20before\x20the\x20order\x20auto-completes\x20and\x20settlement\x20opens.','auto_confirm_hours':'Hours\x20of\x20buyer\x20silence\x20after\x20delivery\x20before\x20the\x20order\x20auto-completes.','balance_amount':'Remaining\x20amount\x20collected\x20in\x20the\x20balance\x20stage\x20(deposit\x20plus\x20balance\x20pricing).','balance_window_days':'Days\x20the\x20buyer\x20has\x20to\x20pay\x20the\x20remaining\x20balance\x20after\x20the\x20deposit.','base_commission_rate_bps':'Base\x20take\x20rate\x20before\x20channel-attribution\x20adjustments.','bounty_high_hunter_bps':'Hunter\x27s\x20share\x20of\x20the\x20high-severity\x20bounty\x20pool,\x20in\x20basis\x20points;\x20the\x20sponsoring\x20company\x20receives\x20the\x20complement\x20(10000\x20minus\x20this).','bounty_medium_hunter_bps':'Hunter\x27s\x20share\x20of\x20the\x20medium-severity\x20bounty\x20pool,\x20in\x20basis\x20points;\x20the\x20sponsoring\x20company\x20receives\x20the\x20complement\x20(10000\x20minus\x20this).','bounty_low_hunter_bps':'Hunter\x27s\x20share\x20of\x20the\x20low-severity\x20bounty\x20pool,\x20in\x20basis\x20points;\x20the\x20sponsoring\x20company\x20receives\x20the\x20complement\x20(10000\x20minus\x20this).','campaign_deadline_ms':'Unix\x20epoch\x20milliseconds\x20at\x20which\x20the\x20campaign\x20closes.\x20Generation\x20DERIVES\x20it\x20from\x20campaign_duration_days\x20when\x20the\x20operator\x20answered\x20the\x20length\x20(build\x20instant\x20+\x20N\x20days,\x20recorded\x20on\x20the\x20plan);\x20pass\x20it\x20directly\x20only\x20when\x20the\x20close\x20date\x20is\x20fixed.','campaign_duration_days':'Running\x20days\x20from\x20launch\x20to\x20campaign\x20close.\x20The\x20unit\x20the\x20operator\x20answers\x20in;\x20generation\x20converts\x20it\x20into\x20the\x20absolute\x20campaign_deadline_ms\x20every\x20chain\x20deadline\x20gate\x20reads.','cancel_tier_1_boundary_hours':'Notice\x20before\x20the\x20service\x20start\x20at\x20which\x20tier\x201\x20begins,\x20in\x20hours\x20(cancelling\x20further\x20out\x20pays\x20the\x20tier-1\x20charge).','cancel_tier_2_boundary_hours':'Notice\x20before\x20the\x20service\x20start\x20at\x20which\x20tier\x202\x20begins,\x20in\x20hours.','cancel_tier_3_boundary_hours':'Notice\x20before\x20the\x20service\x20start\x20at\x20which\x20tier\x203\x20(the\x20no-show\x20band)\x20begins,\x20in\x20hours.','cancel_tier_1_charge_bps':'Cancellation\x20charge\x20for\x20the\x20earliest\x20band\x20(most\x20notice),\x20in\x20basis\x20points\x20of\x20the\x20order\x20amount;\x20the\x20buyer\x20is\x20refunded\x20the\x20complement.','cancel_tier_2_charge_bps':'Cancellation\x20charge\x20for\x20the\x20middle-early\x20band,\x20in\x20basis\x20points\x20of\x20the\x20order\x20amount;\x20the\x20buyer\x20is\x20refunded\x20the\x20complement.','cancel_tier_3_charge_bps':'Cancellation\x20charge\x20for\x20the\x20middle-late\x20band,\x20in\x20basis\x20points\x20of\x20the\x20order\x20amount;\x20the\x20buyer\x20is\x20refunded\x20the\x20complement.','cancel_tier_4_charge_bps':'Cancellation\x20charge\x20for\x20the\x20last-minute\x20(no-show)\x20band,\x20in\x20basis\x20points\x20of\x20the\x20order\x20amount;\x20the\x20buyer\x20is\x20refunded\x20the\x20complement.','service_start_ms':'Unix\x20epoch\x20milliseconds\x20of\x20the\x20service/departure\x20start,\x20shared\x20by\x20every\x20order\x20of\x20that\x20service;\x20the\x20cancellation\x20bands\x20measure\x20notice\x20against\x20it.','cancellation_policy':'Prose\x20cancellation\x20policy;\x20the\x20enforceable\x20values\x20are\x20the\x20cancel-window\x20keys.','claim_window_days':'Days\x20after\x20delivery\x20in\x20which\x20the\x20buyer\x20can\x20file\x20a\x20dispute\x20before\x20settlement\x20opens.','claim_window_hours':'Hours\x20of\x20the\x20dispute-filing\x20window\x20after\x20delivery.','claim_window_open_min_hold_hours':'Hours\x20after\x20delivery\x20before\x20the\x20keeper\x20may\x20open\x20the\x20dispute\x20window\x20—\x20the\x20claim\x20clock\x20cannot\x20start\x20at\x20the\x20delivery\x20instant.','dispatch_window_hours':'Hours\x20after\x20the\x20order\x20sits\x20ready\x20in\x20which\x20a\x20rostered\x20rider\x20must\x20pick\x20it\x20up;\x20elapsed\x20with\x20no\x20pickup,\x20the\x20platform\x20force-cancels\x20penalty-free\x20into\x20the\x20full-refund\x20terminal\x20(capacity\x20shortage\x20is\x20the\x20platform\x27s\x20fulfillment\x20failure).','co_holder_bps':'Share,\x20in\x20basis\x20points,\x20held\x20by\x20a\x20co-holder\x20of\x20the\x20asset\x20or\x20right.','commission_rate_bps':'Platform\x20take\x20rate\x20per\x20settled\x20order,\x20in\x20basis\x20points\x20(0\x20keeps\x20the\x20merchant\x20the\x20full\x20amount).','confirm_timeout_hours':'Hours\x20the\x20merchant\x20has\x20to\x20confirm\x20an\x20order\x20before\x20it\x20auto-cancels.','confirm_window_hours':'Window,\x20in\x20hours,\x20for\x20confirming\x20the\x20order\x20or\x20handover.','contract_fee_large_usd':'Flat\x20contract\x20fee\x20for\x20large\x20engagements.','contract_fee_small_usd':'Flat\x20contract\x20fee\x20for\x20small\x20engagements.','contract_fee_tier_boundary_usd':'Contract\x20value,\x20in\x20USD,\x20separating\x20the\x20small\x20from\x20the\x20large\x20fee\x20tier.','courier_fee':'Courier\x20delivery\x20fee.','courier_tip_bps':'Rider\x20tip\x20or\x20incentive,\x20in\x20basis\x20points\x20of\x20the\x20order\x20value.','course_price_usd':'Price\x20of\x20one\x20course\x20seat\x20in\x20USD.','creator_settlement_retain_bps':'Share\x20of\x20each\x20settlement\x20the\x20creator\x20keeps\x20(the\x20rest\x20funds\x20platform\x20and\x20fee\x20legs).','damage_max_amount':'Maximum\x20damage\x20compensation\x20payable\x20out\x20of\x20the\x20escrow.','defect_report_window_hours':'Hours\x20after\x20delivery\x20in\x20which\x20a\x20defect\x20or\x20damage\x20must\x20be\x20reported.','delivery_window_days':'Promised\x20delivery\x20window\x20in\x20days.','deposit_amount':'Up-front\x20deposit\x20collected\x20at\x20order\x20time\x20(the\x20rest\x20is\x20collected\x20later).','deposit_exit_policy':'Prose\x20policy\x20for\x20exiting\x20or\x20refunding\x20the\x20deposit.','deposit_refund_days':'Days\x20after\x20checkout\x20within\x20which\x20the\x20deposit\x20is\x20refunded.','digital_product_fee_bps':'Fee\x20rate\x20charged\x20on\x20digital\x20product\x20sales.','digital_product_fee_max_usd':'Cap\x20on\x20the\x20digital\x20product\x20fee,\x20in\x20USD.','digital_product_fee_min_usd':'Floor\x20on\x20the\x20digital\x20product\x20fee,\x20in\x20USD.','dispute_timeout_days':'Days\x20after\x20a\x20dispute\x20is\x20filed\x20before\x20it\x20escalates\x20or\x20defaults.','dispute_window_days':'Days\x20after\x20delivery\x20to\x20escalate\x20a\x20complaint\x20to\x20arbitration.','early_exit_penalty_amount':'Flat\x20penalty\x20charged\x20on\x20early\x20termination.','early_exit_penalty_months':'Months\x20of\x20rent\x20charged\x20as\x20the\x20early-exit\x20penalty.','errand_line':'Errand\x20service\x20line;\x20this\x20selector\x20changes\x20which\x20rails\x20the\x20machine\x20installs.','escrow_release_days':'Days\x20the\x20escrow\x20holds\x20before\x20the\x20funds\x20release\x20to\x20the\x20merchant.','evaluation_window_days':'Days\x20allowed\x20to\x20evaluate\x20a\x20submitted\x20deliverable.','evidence_window_hours':'Hours\x20to\x20submit\x20evidence\x20once\x20a\x20dispute\x20is\x20open.','free_cancel_hours':'Hours\x20after\x20purchase\x20during\x20which\x20cancellation\x20is\x20free\x20(full\x20refund).','full_price':'List\x20price\x20before\x20discounts\x20or\x20the\x20deposit\x20split.','funding_threshold':'Amount\x20that\x20must\x20be\x20raised\x20for\x20the\x20campaign\x20to\x20succeed.','grace_days':'Grace\x20period\x20in\x20days\x20before\x20a\x20late\x20payment\x20counts\x20as\x20a\x20breach.','host_rate_bps':'Host\x20payout\x20share\x20of\x20the\x20booking\x20value,\x20in\x20basis\x20points.','incumbent_take_bps':'Take\x20rate\x20of\x20the\x20incumbent\x20platform\x20(comparison\x20only).','inspection_deadline_hours':'Hours\x20to\x20complete\x20the\x20inspection\x20after\x20handover.','inspection_window_days':'Days\x20of\x20inspection\x20window\x20after\x20delivery.','instant_cancel_hours':'Hours\x20within\x20which\x20cancellation\x20takes\x20effect\x20immediately.','institution_share_bps':'Share\x20of\x20course\x20revenue\x20paid\x20to\x20the\x20institution.','kill_fee_bps':'Fee\x20kept\x20from\x20the\x20escrow\x20when\x20the\x20buyer\x20cancels\x20after\x20acceptance.','kill_fee_buyer_bps':'Late-cancellation\x20fee\x20charged\x20to\x20the\x20buyer.','layer2_segment_amounts':'Segment\x20amounts\x20of\x20the\x20second\x20allocation\x20layer\x20(directive\x20formula).','leader_commission_bps':'Commission\x20paid\x20to\x20the\x20group\x20leader\x20on\x20each\x20member\x20order.','lease_months':'Lease\x20length\x20in\x20months.','max_months':'Longest\x20subscription\x20or\x20lease\x20term,\x20in\x20months.','max_sessions':'Maximum\x20sessions\x20included\x20in\x20the\x20plan.','membership_price':'Membership\x20price\x20per\x20period.','merchant_service_fee_bps':'Incumbent\x20marketplace\x27s\x20merchant-side\x20service\x20fee\x20(benchmark,\x20comparison\x20only).\x20WoWok\x20is\x20DIRECT\x20SALES\x20here:\x20this\x20store\x20pays\x20no\x20platform\x20commission,\x20so\x20the\x20shipped\x20value\x20is\x200\x20and\x20no\x20money\x20rail\x20reads\x20it\x20—\x20set\x20it\x20only\x20if\x20YOU\x20are\x20the\x20aggregator\x20charging\x20your\x20own\x20sellers.','min_balance':'Minimum\x20balance\x20that\x20must\x20remain\x20(directive\x20floor).','min_booking_amount':'Minimum\x20bookable\x20amount\x20(directive\x20floor).','min_contract_usd':'Minimum\x20contract\x20value\x20in\x20USD\x20(directive\x20floor).','min_course_price_usd':'Minimum\x20course\x20price\x20in\x20USD\x20(directive\x20floor).','min_monthly_rent_usd':'Minimum\x20monthly\x20rent\x20in\x20USD\x20(directive\x20floor).','min_order_price':'Minimum\x20order\x20price\x20(directive\x20floor).','min_sku_price':'Minimum\x20SKU\x20price\x20(directive\x20floor).','min_term_price':'Minimum\x20price\x20per\x20term:\x20the\x20numeric\x20floor\x20the\x20settlement\x20fixed\x20legs\x20must\x20fit\x20under\x20(per-session\x20releases\x20count\x20the\x20whole\x20term).','min_term_price_usd':'Minimum\x20price\x20per\x20term\x20in\x20USD\x20(directive\x20floor).','max_discount_bps':'Ceiling\x20on\x20any\x20coupon\x20the\x20merchant\x20may\x20issue\x20against\x20this\x20shape,\x20in\x20basis\x20points\x20—\x20derived\x20from\x20how\x20much\x20the\x20fixed\x20legs\x20leave\x20above\x20the\x20price\x20floor.','month_release_day':'Day\x20of\x20the\x20month\x20on\x20which\x20the\x20monthly\x20release\x20runs.','monthly_allocators':'Monthly\x20allocators\x20to\x20open,\x20one\x20per\x20release\x20period.','monthly_rent_amount':'Monthly\x20rent\x20amount.','no_fault_exit_days':'Days\x20of\x20notice\x20required\x20for\x20a\x20no-fault\x20exit.','no_show_floor_hours':'Hours\x20after\x20which\x20a\x20no-show\x20releases\x20the\x20slot\x20with\x20a\x20floor\x20charge.','objection_window_hours':'Hours\x20to\x20object\x20after\x20a\x20proposal\x20or\x20claim.','offsite_ads_rate_bps':'Take\x20rate\x20on\x20off-site\x20advertising-attributed\x20sales.','partner_share_bps':'Share\x20of\x20revenue\x20paid\x20to\x20the\x20partner.','payment_fee_bps':'Payment\x20processing\x20fee\x20in\x20basis\x20points.','per_session_release':'Amount\x20released\x20per\x20completed\x20session.','period_days':'Length\x20of\x20one\x20billing\x20period\x20in\x20days.','pickup_window_hours':'Hours\x20within\x20which\x20pickup\x20must\x20be\x20completed.','platform_commission_bps':'Platform\x20take\x20rate\x20per\x20settled\x20order,\x20in\x20basis\x20points\x20(0\x20keeps\x20the\x20merchant\x20the\x20full\x20amount).','platform_commission_rate_bps':'Platform\x20take\x20rate\x20per\x20settled\x20order,\x20in\x20basis\x20points.','platform_fee_rate_bps':'Platform\x20fee\x20rate\x20applied\x20to\x20the\x20order\x20value,\x20in\x20basis\x20points.','platform_rate_bps':'Platform\x20rate\x20applied\x20to\x20the\x20order\x20value,\x20in\x20basis\x20points.','platform_rate_cap_bps':'Upper\x20bound\x20on\x20the\x20platform\x20take\x20rate.','platform_share_bps':'Share\x20of\x20the\x20order\x20kept\x20by\x20the\x20platform.','platform_take_bps':'Platform\x20take\x20per\x20settled\x20order,\x20in\x20basis\x20points.','platform_tool_fee_bps':'Fee\x20for\x20using\x20the\x20platform\x20tooling,\x20in\x20basis\x20points.','point_type':'Point\x20or\x20credit\x20type\x20used\x20by\x20the\x20loyalty\x20ledger.','preferred_property_rate_bps':'Commission\x20rate\x20applied\x20to\x20preferred\x20properties.','prepay_cap':'Cap\x20on\x20the\x20amount\x20that\x20may\x20be\x20prepaid.','primary_holder_bps':'Share\x20held\x20by\x20the\x20primary\x20rights\x20holder.','processing_time_days':'Days\x20the\x20supplier\x20takes\x20to\x20process\x20the\x20request.','producer_bps':'Share\x20paid\x20to\x20the\x20producer.','production_lead_days':'Days\x20needed\x20to\x20produce\x20the\x20item\x20before\x20it\x20ships.','property_rate_bps':'Commission\x20rate\x20on\x20property\x20bookings.','protection_cap_usd':'Maximum\x20buyer-protection\x20payout\x20in\x20USD.','publisher_bps':'Share\x20paid\x20to\x20the\x20publisher.','refund_window_days':'Days\x20after\x20delivery\x20in\x20which\x20a\x20refund\x20may\x20be\x20requested.','renewal_reminder_days':'Days\x20before\x20renewal\x20to\x20send\x20the\x20reminder.','required_info_enforcement':'Whether\x20missing\x20required\x20buyer\x20info\x20blocks\x20the\x20order\x20(on/off).','requirements_timeout_hours':'Hours\x20the\x20buyer\x20has\x20to\x20supply\x20missing\x20requirements\x20before\x20the\x20order\x20lapses.','response_timeout_hours':'Hours\x20a\x20seller\x20has\x20to\x20grant\x20or\x20decline\x20a\x20cancel\x20request\x20before\x20a\x20keeper\x20auto-cancels\x20it\x20in\x20the\x20buyer\x27s\x20favour\x20(full\x20refund).','refund_response_hours':'Hours\x20a\x20seller\x20has\x20to\x20grant\x20or\x20decline\x20a\x20refund\x20request\x20before\x20a\x20keeper\x20auto-refunds\x20the\x20buyer\x20in\x20full\x20(the\x20refund-request\x20twin\x20of\x20the\x20cancel\x20clock).','reserve_days':'Days\x20a\x20reserve\x20is\x20held\x20back\x20from\x20the\x20payout.','restock_confirm_days':'Days\x20to\x20confirm\x20restocking\x20after\x20a\x20return\x20arrives.','restock_on_refund':'Restock\x20rule\x20applied\x20when\x20a\x20refund\x20completes\x20(directive).','return_notice_days':'Days\x20of\x20notice\x20required\x20before\x20returning\x20the\x20item.','return_transit_days':'Days\x20allowed\x20for\x20the\x20returned\x20item\x20to\x20travel\x20back.','return_window_days':'Days\x20after\x20delivery\x20in\x20which\x20the\x20buyer\x20may\x20return\x20the\x20item.','return_window_hours':'Hours\x20after\x20delivery\x20in\x20which\x20the\x20buyer\x20may\x20return\x20the\x20item.','review_reward_per_claim':'Bounty\x20paid\x20for\x20one\x20accepted\x20review\x20claim.','review_reward_pool':'Total\x20pool\x20that\x20funds\x20review\x20rewards.','review_window_days':'Days\x20after\x20completion\x20in\x20which\x20a\x20review\x20may\x20be\x20submitted.','revision_rounds_max':'Maximum\x20revision\x20rounds\x20included\x20in\x20the\x20price.','reward_claim_closes_after_days':'Days\x20after\x20completion\x20when\x20the\x20review-reward\x20claim\x20closes.','reward_claim_opens_after_days':'Days\x20after\x20the\x20after-sales\x20window\x20before\x20the\x20review-reward\x20bounty\x20becomes\x20claimable.','segment_count':'Number\x20of\x20allocation\x20segments.','service_fee_rate_bps':'Service\x20fee\x20rate\x20charged\x20on\x20the\x20order.','session_count':'Number\x20of\x20sessions\x20included\x20in\x20the\x20plan.','settle_hours':'Hours\x20after\x20the\x20settlement\x20window\x20opens\x20before\x20funds\x20reach\x20the\x20merchant.','settlement_days':'Days\x20between\x20order\x20completion\x20and\x20settlement\x20to\x20the\x20merchant.','settlement_delay_days':'Delay\x20in\x20days\x20applied\x20to\x20the\x20payout.','setting_lock_days':'Days\x20during\x20which\x20a\x20setting\x20is\x20locked\x20after\x20the\x20order\x20is\x20placed.','shortfall_refund_amount':'Fixed\x20shortfall\x20compensation\x20in\x20absolute\x20chain\x20units,\x20paid\x20instead\x20of\x20the\x20whole\x20pledge\x20on\x20the\x20refund-only\x20bad-item\x20path\x20when\x20after_sales_scope\x20is\x20\x27partial_refund\x27;\x20the\x20listing\x20price\x20must\x20exceed\x20it\x20(minimum\x20order\x20amount\x20discipline).','stay_nights':'Nights\x20per\x20stay.','storefront_mode':'Storefront\x20shape;\x20this\x20selector\x20changes\x20the\x20generated\x20storefront\x20topology.','submission_window_days':'Days\x20to\x20submit\x20the\x20deliverable.','subscription_monthly_usd':'Monthly\x20subscription\x20price\x20in\x20USD.','term_count':'Number\x20of\x20terms\x20or\x20invoices\x20in\x20the\x20contract.','term_price':'Price\x20charged\x20per\x20term.','term_price_usd':'Price\x20charged\x20per\x20term\x20in\x20USD.','threshold':'Escrow\x20amount\x20that\x20triggers\x20the\x20next\x20stage.','tier5_guest_bps':'Cancellation\x20tier\x205:\x20share\x20charged\x20to\x20the\x20guest.','tier5_host_bps':'Cancellation\x20tier\x205:\x20share\x20paid\x20to\x20the\x20host.','tier6_guest_bps':'Cancellation\x20tier\x206:\x20share\x20charged\x20to\x20the\x20guest.','tier6_host_bps':'Cancellation\x20tier\x206:\x20share\x20paid\x20to\x20the\x20host.','triage_window_days':'Days\x20to\x20triage\x20a\x20report\x20before\x20it\x20escalates.','tuition_usd':'Tuition\x20per\x20enrollment\x20in\x20USD.','unclaimed_exit':'What\x20happens\x20to\x20an\x20order\x20the\x20buyer\x20never\x20collects:\x20refund_buyer\x20(default)\x20returns\x20the\x20principal\x20in\x20full\x20after\x20the\x20pickup\x20window,\x20settle_merchant\x20opens\x20the\x20serial\x20claim\x20window\x20and\x20settles\x20to\x20the\x20supplier\x20with\x20the\x20buyer\x20keeping\x20a\x20late-appeal\x20refund\x20route.','withdrawal_window_days':'Days\x20during\x20which\x20withdrawal\x20is\x20allowed.'};export const CURATED_MEANING_COUNT=Object['keys'](PARAM_MEANINGS)['length'];const KIND_WORD={'money':'amount','ratio':'rate','duration':'duration','count':'count','enum':'option','flag':'on/off\x20switch','text':'text','list':'list\x20of\x20values'};export function paramMeaning(a,b,c,d){const e=PARAM_MEANINGS[a];if(e!==undefined)return e;const f=d['length']>0x0?'\x20on\x20the\x20'+d['join']('/')+'\x20facet':'';return'Not\x20yet\x20described\x20—\x20a\x20'+KIND_WORD[b]+(c!=='unitless'?'\x20in\x20'+c:'')+f+'.';}export const PARAM_ALIASES=[['take\x20rate',['platform_commission_bps','platform_commission_rate_bps','platform_take_bps','platform_fee_rate_bps','platform_rate_bps','commission_rate_bps','merchant_service_fee_bps','incumbent_take_bps']],['commission',['platform_commission_bps','commission_rate_bps','leader_commission_bps','attributed_commission_rate_bps']],['get\x20paid',['settle_hours','settlement_days','settlement_delay_days','escrow_release_days','month_release_day']],['payout',['settle_hours','settlement_days','settlement_delay_days','escrow_release_days','reserve_days']],['refund',['return_window_days','refund_window_days','deposit_refund_days','free_cancel_hours']],['cancel',['free_cancel_hours','instant_cancel_hours','kill_fee_bps','cancel_tier_1_charge_bps','cancel_tier_2_charge_bps','cancel_tier_3_charge_bps','cancel_tier_4_charge_bps']],['dispute',['claim_window_days','dispute_window_days','dispute_timeout_days','arbitration_fee_usd']],['deposit',['deposit_amount','balance_amount','prepay_cap']],['tip',['courier_tip_bps','courier_fee']],['reward',['review_reward_pool','review_reward_per_claim','reward_claim_opens_after_days','reward_claim_closes_after_days']],['bounty',['bounty_high_hunter_bps','bounty_medium_hunter_bps','bounty_low_hunter_bps']],['hunter\x20share',['bounty_high_hunter_bps','bounty_medium_hunter_bps','bounty_low_hunter_bps']],['review',['review_window_days','review_reward_per_claim','review_reward_pool']],['rent',['monthly_rent_amount','lease_months','early_exit_penalty_months']],['delivery',['delivery_window_days','courier_fee','pickup_window_hours']],['membership',['membership_price','subscription_monthly_usd','annual_plan_usd','period_days']],['commission\x20cap',['platform_rate_cap_bps','protection_cap_usd']],['fee',['arbitration_fee_usd','payment_fee_bps','courier_fee','platform_tool_fee_bps']],['how\x20much\x20do\x20i\x20keep',['platform_commission_bps','platform_take_bps','platform_share_bps','commission_rate_bps']],['late\x20fee',['kill_fee_bps','early_exit_penalty_months','cancel_tier_4_charge_bps']],['no\x20show',['no_show_floor_hours']],['holdback',['reserve_days','creator_settlement_retain_bps','setting_lock_days']],['minimum\x20order',['min_order_price','min_contract_usd','min_course_price_usd','min_booking_amount','min_sku_price']],['campaign\x20length',['campaign_duration_days']],['arbitration\x20fee',['arbitration_fee_usd']],['dispute\x20window',['dispute_window_days','dispute_timeout_days','claim_window_days']],['late\x20delivery',['delivery_window_days','auto_confirm_days','auto_confirm_hours']],['plan\x20price',['subscription_monthly_usd','annual_plan_usd','membership_price']],['renewal\x20reminder',['renewal_reminder_days']],['shipping\x20deadline',['processing_time_days','delivery_window_days']],['down\x20payment',['deposit_amount','balance_amount','deposit_refund_days']],['balance\x20due',['balance_amount','balance_window_days']],['notice\x20period',['return_notice_days','no_fault_exit_days','early_exit_penalty_months']],['guest\x20count',['tier5_guest_bps','tier6_guest_bps']],['tiered\x20pricing',['tier5_guest_bps','tier6_guest_bps']],['cancellation\x20charge',['cancel_tier_1_charge_bps','cancel_tier_2_charge_bps','cancel_tier_3_charge_bps','cancel_tier_4_charge_bps']],['money\x20released',['settle_hours','settlement_days','settlement_delay_days','escrow_release_days','month_release_day','reserve_days']],['release\x20the\x20money',['settle_hours','settlement_days','settlement_delay_days','escrow_release_days','month_release_day','reserve_days']]];const MAX_BY_UNIT={'hours':{'max':0x2238,'hint':'0..8760\x20(one\x20year;\x200\x20=\x20unset)'},'days':{'max':0x16d,'hint':'0..365\x20(one\x20year;\x200\x20=\x20unset)'},'months':{'max':0x3c,'hint':'0..60\x20(five\x20years)'},'nights':{'max':0x16d,'hint':'0..365\x20nights'},'ms':{'max':0x3bb2cc3d800,'hint':'milliseconds;\x20absolute\x20deadlines\x20may\x20be\x20epoch\x20ms\x20(up\x20to\x20year\x202100)'},'count':{'max':0x186a0,'hint':'0\x20or\x20more,\x20whole\x20numbers'}},PARAM_RANGE_OVERRIDES={'stay_nights':{'min':0x1,'max':0x16d,'hint':'1..365\x20nights'},'period_days':{'min':0x1,'max':0x16e,'hint':'1..366\x20days\x20(a\x20monthly\x20period\x20is\x2030,\x20a\x20leap\x20year\x20366)'},'lease_months':{'min':0x1,'max':0x78,'hint':'1..120\x20months'},'max_months':{'min':0x1,'max':0x78,'hint':'1..120\x20months'},'month_release_day':{'min':0x1,'max':0x1f,'hint':'1..31\x20(a\x20day\x20of\x20the\x20month)'},'revision_rounds_max':{'min':0x0,'max':0x64,'hint':'0..100\x20rounds'}};export function boundsFor(a,b,c){if(a==='enum'||a==='flag'||a==='text'||a==='list')return undefined;if(b==='bps')return{'min':0x0,'max':0x2710,'hint':'0..10000\x20(100\x20bps\x20=\x201%)'};if(c!==undefined&&PARAM_RANGE_OVERRIDES[c]!==undefined)return PARAM_RANGE_OVERRIDES[c];if(a==='money')return{'min':0x0,'hint':'0\x20or\x20more'};const d=MAX_BY_UNIT[b];if(a==='count')return{'min':0x0,'max':MAX_BY_UNIT['count']['max'],'hint':MAX_BY_UNIT['count']['hint']};if(a==='duration'){if(d!==undefined)return{'min':0x0,'max':d['max'],'hint':d['hint']};return{'min':0x0,'hint':'0\x20or\x20more\x20in\x20the\x20row\x27s\x20unit\x20(0\x20=\x20unset)'};}return undefined;}export function kindFor(a,b,c,d){if(c)return'enum';if(typeof b==='string'){if(/^(on|off|true|false)$/i['test'](b))return'flag';if(/^\s*-?\d+(?:\.\d+)?(?:\s*\/\s*-?\d+(?:\.\d+)?)+\s*$/['test'](b))return'list';return'enum';}const e=unitFor(a);if(e==='usd')return'money';if(e==='bps')return'ratio';if(e==='hours'||e==='days'||e==='ms'||e==='months'||e==='nights')return'duration';if(e==='count')return'count';if(d['includes']('pricing')||/amount|price|pool|cap|threshold|fee|cost|rent|reward|_per_claim|_release$|_retain|_tip$|tuition|balance|prepay|_share/['test'](a))return'money';return'count';}export function paramSchema(a){const b=new Set((a['conditional_guards']??[])['map'](e=>e['param'])),d=new Map();for(const e of a['conditional_guards']??[]){if(e['values']===undefined)continue;const f=d['get'](e['param'])??[];for(const g of e['values'])if(!f['includes'](g))f['push'](g);d['set'](e['param'],f);}return Object['entries'](a['fee_params'])['map'](([h,i])=>{const j=b['has'](h),k=classifyFeeParam(h,i,j),l=tagsFor(h),m=kindFor(h,i,j,l),n=unitFor(h),o=m==='money'&&n==='unitless'?'mist':n;return{'key':h,'tier':k['tier'],'tier_name':k['tier_name'],'group':k['group'],'tags':l,'kind':m,'unit':o,'unit_hint':unitHint(o),'meaning':paramMeaning(h,m,o,l),'type':typeof i==='number'?'number':'string','default':i,'bounds':boundsFor(m,o,h),'allowed':d['get'](h)??[],'disclosure':k['disclosure'],'selector':j,'settable_by':'merchant'};})['sort']((h,i)=>h['tier']-i['tier']||h['key']['localeCompare'](i['key']));}export function resolveUserInputQuestions(a){const b=new Map(paramSchema(a)['map'](c=>[c['key'],c]));return(a['user_input_specs']??[])['map'](c=>{const d=b['get'](c['param_key']);if(d===undefined)throw new Error('user_input_spec\x20\x27'+c['question']+'\x27\x20binds\x20undeclared\x20fee_param\x20\x27'+c['param_key']+'\x27\x20—\x20declare\x20the\x20key\x20in\x20fee_params\x20first');return{'question':c['question'],'param_key':c['param_key'],...c['note']!==undefined?{'note':c['note']}:{},'default':d['default'],'unit_hint':d['unit_hint'],'meaning':d['meaning'],...d['bounds']!==undefined?{'bounds':d['bounds']}:{},'allowed':d['allowed']};});}const STOPWORDS=new Set(['the','a','an','of','for','to','how','what','is','my','can','i','set','and','in','on','do','per','each']),WORD_SYNONYMS={'shipping':'ship','shipment':'ship','shipped':'ship','delivery':'deliver','deliveries':'deliver','restocking':'restock','restocked':'restock','renewals':'renewal'};function singular(a){if(a['length']<=0x3)return a;if(a['endsWith']('ies'))return a['slice'](0x0,-0x3)+'y';if(/(?:ses|xes|zes|ches|shes)$/['test'](a))return a['slice'](0x0,-0x2);if(a['endsWith']('s')&&!a['endsWith']('ss'))return a['slice'](0x0,-0x1);return a;}function canon(a){return WORD_SYNONYMS[a]??WORD_SYNONYMS[singular(a)]??singular(a);}function tokens(a){return a['toLowerCase']()['split'](/[^a-z0-9]+/)['filter'](b=>b['length']>0x1&&!STOPWORDS['has'](b))['map'](canon);}function keyWords(a){return a['toLowerCase']()['split'](/[^a-z0-9]+/)['filter'](b=>b['length']>0x1)['map'](canon);}const MIN_SCORE=0x4;export function matchParams(a,b,c=0x5){const d=tokens(a);if(d['length']===0x0)return[];const e=d['every'](m=>TAG_SET['has'](m))&&!b['some'](m=>keyWords(m['key'])['some'](n=>d['includes'](n))),f=a['toLowerCase']()['replace'](/[^a-z0-9]+/g,'_'),g='\x20'+a['toLowerCase']()['replace'](/[^a-z0-9]+/g,'\x20')['trim']()+'\x20',h=g['trim']()['split']('\x20')[0x0]??'',i=new Set(),j=[];for(const [m,n]of PARAM_ALIASES){if(!g['includes']('\x20'+m+'\x20')&&!g['includes']('\x20'+m+'s\x20'))continue;if(!m['includes']('\x20')&&m!==h)continue;j['push'](m);for(const o of n)i['add'](o);}const l=[];for(const p of b){if(p['disclosure']==='hidden')continue;let r=0x0;const s=[],u=new Set(),v=keyWords(p['key']);(p['key']===f||f['includes'](p['key']))&&(r+=0xa,s['push']('key:'+p['key']));for(const w of d){(v['includes'](w)||p['key']['includes']('_'+w))&&(r+=0x3,u['add'](w),s['push']('key-word:'+w)),p['tags']['includes'](w)&&(r+=0x2,u['add'](w),s['push']('tag:'+w));}i['has'](p['key'])&&(r+=0x6,s['push'](...j['map'](x=>'alias:'+x)));e&&d['every'](x=>p['tags']['includes'](x))&&(r+=0x4,s['push']('facet:'+d['join']('+')));if(p['meaning']!==undefined){const x=p['meaning']['toLowerCase']();let y=0x0;for(const z of d){if(y>=0x2)break;if(u['has'](z))continue;x['includes'](z)&&(r+=0x1,y++,s['push']('meaning:'+z));}}if(r<MIN_SCORE)continue;l['push']({'row':p,'score':r+0x1,'reasons':[...new Set(s)]});}return e?l['sort']((A,B)=>A['row']['tier']-B['row']['tier']||B['score']-A['score']||A['row']['key']['localeCompare'](B['row']['key'])):l['sort']((A,B)=>B['score']-A['score']||A['row']['key']['localeCompare'](B['row']['key'])),l['slice'](0x0,c);}export function searchTemplates(a,b,c,d=0x8){const e=[];for(const f of b){for(const g of matchParams(a,c(f),0x2)){e['push']({'template':f['id'],'key':g['row']['key'],'tier':g['row']['tier'],'disclosure':g['row']['disclosure'],'score':g['score']});}}return e['sort']((h,i)=>i['score']-h['score']||h['template']['localeCompare'](i['template'])),e['slice'](0x0,d);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const TIER_NAMES={0x1:'money\x20&\x20admission',0x2:'time\x20&\x20payout',0x3:'flow\x20switch',0x4:'role\x20&\x20permission',0x5:'disclosure\x20&\x20copy'};const BENCHMARK_KEYS=new Set(['incumbent_take_bps','merchant_service_fee_bps','platform_rate_cap_bps']),DIRECTIVE_KEYS=new Set(['allocator_threshold','min_sku_price','min_balance','min_term_price_usd','min_term_price','min_monthly_rent_usd','min_booking_amount','min_course_price_usd','layer2_segment_amounts','restock_on_refund']),MONEY_RE=/(_bps$|_usd$|_amount$|_threshold$|^threshold$|^deposit|_cap$|_cap_usd$|_fee$|_fee_|_price$|_pool$|_per_claim$|_cost$|_rent$|_rate$|_share$|_release$)/,TIME_RE=/(_hours$|_days$|_ms$|_timeout$|_window$|_deadline$|^period_|_months$|_nights$|_rounds_max$|_count$|_sessions$|_allocators$|_day$)/;function moneyOrTime(a){if(TIME_RE['test'](a))return 0x2;if(MONEY_RE['test'](a))return 0x1;return 0x5;}export function classifyFeeParam(a,b,c=![]){const d=g=>TIER_NAMES[g];if(c)return{'tier':0x3,'tier_name':d(0x3),'group':'flow','disclosure':'knob'};if(DIRECTIVE_KEYS['has'](a)||typeof b==='string')return{'tier':0x5,'tier_name':d(0x5),'group':'flow','disclosure':'hidden'};const e=moneyOrTime(a);if(BENCHMARK_KEYS['has'](a))return{'tier':e,'tier_name':d(e),'group':'sales','disclosure':'card'};const f=e===0x1?/_price$|_usd$|_fee|_bps$|_cost$/['test'](a)?'sales':'funds':e===0x2?'funds':'flow';return{'tier':e,'tier_name':d(e),'group':f,'disclosure':'knob'};}export function describeFeeParams(a){const b=new Set((a['conditional_guards']??[])['map'](d=>d['param']));return Object['entries'](a['fee_params'])['map'](([c,d])=>{const e=b['has'](c);return{...classifyFeeParam(c,d,e),'key':c,'value':d,'type':typeof d==='number'?'number':'string','selector':e};})['sort']((c,d)=>c['tier']-d['tier']||c['key']['localeCompare'](d['key']));}
|
|
1
|
+
export const TIER_NAMES={0x1:'money\x20&\x20admission',0x2:'time\x20&\x20payout',0x3:'flow\x20switch',0x4:'role\x20&\x20permission',0x5:'disclosure\x20&\x20copy'};const BENCHMARK_KEYS=new Set(['incumbent_take_bps','merchant_service_fee_bps','platform_rate_cap_bps']),BUILD_PRESCRIPTION_KEYS=new Set(['creator_settlement_retain_bps']),DIRECTIVE_KEYS=new Set(['allocator_threshold','min_sku_price','min_balance','min_term_price_usd','min_term_price','min_monthly_rent_usd','min_booking_amount','min_course_price_usd','layer2_segment_amounts','restock_on_refund']),MONEY_RE=/(_bps$|_usd$|_amount$|_threshold$|^threshold$|^deposit|_cap$|_cap_usd$|_fee$|_fee_|_price$|_pool$|_per_claim$|_cost$|_rent$|_rate$|_share$|_release$)/,TIME_RE=/(_hours$|_days$|_ms$|_timeout$|_window$|_deadline$|^period_|_months$|_nights$|_rounds_max$|_count$|_sessions$|_allocators$|_day$)/;function moneyOrTime(a){if(TIME_RE['test'](a))return 0x2;if(MONEY_RE['test'](a))return 0x1;return 0x5;}export function classifyFeeParam(a,b,c=![]){const d=g=>TIER_NAMES[g];if(c)return{'tier':0x3,'tier_name':d(0x3),'group':'flow','disclosure':'knob'};if(DIRECTIVE_KEYS['has'](a)||typeof b==='string')return{'tier':0x5,'tier_name':d(0x5),'group':'flow','disclosure':'hidden'};const e=moneyOrTime(a);if(BENCHMARK_KEYS['has'](a))return{'tier':e,'tier_name':d(e),'group':'sales','disclosure':'card'};if(BUILD_PRESCRIPTION_KEYS['has'](a))return{'tier':e,'tier_name':d(e),'group':'funds','disclosure':'card'};const f=e===0x1?/_price$|_usd$|_fee|_bps$|_cost$/['test'](a)?'sales':'funds':e===0x2?'funds':'flow';return{'tier':e,'tier_name':d(e),'group':f,'disclosure':'knob'};}export function describeFeeParams(a){const b=new Set((a['conditional_guards']??[])['map'](d=>d['param']));return Object['entries'](a['fee_params'])['map'](([c,d])=>{const e=b['has'](c);return{...classifyFeeParam(c,d,e),'key':c,'value':d,'type':typeof d==='number'?'number':'string','selector':e};})['sort']((c,d)=>c['tier']-d['tier']||c['key']['localeCompare'](d['key']));}
|