@wowok/agent-mcp 3.4.0 → 3.4.2
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/arbitration-templates.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +4 -3
- 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 +28 -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/customer-interest.d.ts +4 -0
- package/dist/participation/customer-interest.js +1 -1
- package/dist/participation/node-action-advisor.d.ts +4 -0
- package/dist/participation/node-action-advisor.js +1 -1
- package/dist/participation/radar-core.js +1 -1
- package/dist/participation/time-window.d.ts +11 -0
- 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/proof.js +1 -1
- 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 +143 -45
- 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 +345 -84
- 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 +27 -2
- 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 +1265 -671
- 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 +9 -2
- 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 +232 -125
- 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 +20 -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 +30 -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_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD}from'./onchain-constants.js';export{MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD};export const REWARD_NEW={'index':0x96,'name':'REWARD_NEW','description':'Create\x20new\x20Reward<T>','governed_operations':['create\x20a\x20new\x20Reward\x20pool'],'sdk_exposed':!![]};export const REWARD_DESCRIPTION={'index':0x97,'name':'REWARD_DESCRIPTION','description':'Update\x20description','governed_operations':['update\x20the\x20Reward\x20description'],'sdk_exposed':!![]};export const REWARD_GUARD={'index':0x98,'name':'REWARD_GUARD','description':'Add\x20/\x20remove\x20expired\x20guards\x20(≤\x20MAX_GUARD_COUNT_REWARD=200)','governed_operations':['add\x20a\x20claim\x20guard\x20to\x20the\x20Reward','remove\x20expired\x20claim\x20guards'],'sdk_exposed':!![]};export const REWARD_COIN_ADD={'index':0x99,'name':'REWARD_COIN_ADD','description':'Deposit\x20Coin<T>\x20directly\x20into\x20Reward\x20balance\x20(joins\x20Balance<T>)','governed_operations':['deposit\x20Coin<T>\x20into\x20the\x20Reward\x20balance'],'sdk_exposed':!![]};export const REWARD_RECEIVE={'index':0x9a,'name':'REWARD_RECEIVE','description':'Receive\x20CoinWrapper<T>\x20into\x20the\x20balance\x20(unwrapped\x20with\x20balance\x20check)','governed_operations':['receive\x20a\x20CoinWrapper<T>\x20payment\x20into\x20the\x20balance'],'sdk_exposed':!![]};export const REWARD_GUARD_EXPIRATION_TIME_ADD={'index':0x9b,'name':'REWARD_GUARD_EXPIRATION_TIME_ADD','description':'Set\x20/\x20cancel\x20guard_not_added_expiration_time\x20(time-lock\x20on\x20new\x20guard\x20additions)','governed_operations':['set\x20or\x20cancel\x20the\x20time-lock\x20on\x20adding\x20new\x20guards'],'sdk_exposed':!![]};export const REWARD_OWNER_RECEIVE={'index':0x9c,'name':'REWARD_OWNER_RECEIVE','description':'Owner\x20receives\x20Receiving<K>\x20/\x20CoinWrapper<K>\x20at\x20terminal\x20state\x20(unwrap\x20→\x20owner)','governed_operations':['owner\x20receipt\x20of\x20payments\x20at\x20terminal\x20state\x20(unwrapped\x20to\x20the\x20owner)','owner\x20receipt\x20of\x20whole\x20objects\x20at\x20terminal\x20state'],'sdk_exposed':!![]};export const REWARD_UM={'index':0x9d,'name':'REWARD_UM','description':'Bind\x20/\x20unbind\x20Contact\x20(UM)\x20for\x20off-chain\x20coordination','governed_operations':['bind\x20a\x20Contact\x20as\x20the\x20UM\x20coordinator','unbind\x20the\x20UM\x20Contact'],'sdk_exposed':!![]};export const REWARD_WITHDRAW={'index':0x9e,'name':'REWARD_WITHDRAW','description':'Withdraw\x20balance\x20from\x20the\x20Reward\x20to\x20the\x20tx\x20sender\x20inside\x20a\x20Payment\x20object\x20receipt\x20(ETS-B,\x20the\x20only\x20non-claim\x20exit;\x20blocked\x20while\x20the\x20declared\x20no-guard\x20window\x20guard_not_added_expiration_time\x20is\x20in\x20the\x20future)','governed_operations':['withdraw\x20an\x20amount\x20from\x20the\x20Reward\x20balance,\x20delivered\x20to\x20the\x20executing\x20account\x20inside\x20a\x20Payment\x20object\x20(the\x20on-chain\x20receipt;\x20unwrap\x20mode\x20pays\x20the\x20coin\x20out\x20in\x20the\x20same\x20transaction)\x20(fails\x20with\x20E_GUARD_LOCKED_TIME\x20while\x20guard_not_added_expiration_time\x20is\x20in\x20the\x20future)'],'sdk_exposed':!![]};export const REWARD_PERMISSIONS=[REWARD_NEW,REWARD_DESCRIPTION,REWARD_GUARD,REWARD_COIN_ADD,REWARD_RECEIVE,REWARD_GUARD_EXPIRATION_TIME_ADD,REWARD_OWNER_RECEIVE,REWARD_UM,REWARD_WITHDRAW];export const REWARD_FIELDS=[{'name':'id','move_type':'UID','mutability':'immutable','set_at_creation':!![],'constraint':'Object\x20UID;\x20assigned\x20at\x20creation.\x20Never\x20changes.'},{'name':'description','move_type':'String','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x97,'constraint':'Must\x20satisfy\x20common::DESCRIPTION.\x20Updated\x20via\x20permission\x20151.'},{'name':'guards','move_type':'vector<RewardGuard>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x98,'constraint':'vector::length\x20<\x20MAX_GUARD_COUNT\x20(200);\x20E_GUARD_COUNT_EXCEEDED\x20on\x20overflow.','related_errors':['E_GUARD_COUNT_EXCEEDED']},{'name':'balance','move_type':'Balance<T>','mutability':'runtime','set_at_creation':!![],'constraint':'Zero\x20at\x20creation\x20(balance::zero());\x20grows\x20via\x20coin_add/receive;\x20shrinks\x20via\x20claim\x20(split)\x20and\x20via\x20withdraw\x20(ETS-B,\x20funds\x20leave\x20inside\x20a\x20Payment\x20object\x20receipt,\x20only\x20when\x20the\x20no-guard\x20window\x20has\x20elapsed).','related_errors':['E_INSUFFICIENT_BALANCE','E_GUARD_LOCKED_TIME']},{'name':'guard_not_added_expiration_time','move_type':'Option<u64>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x9b,'constraint':'Option<timestamp_ms>.\x20When\x20Some(t):\x20guard_add\x20AND\x20withdraw\x20require\x20clock\x20>\x20t\x20(E_GUARD_LOCKED_TIME).\x20When\x20None\x20or\x20t\x20<\x20now:\x20guards\x20can\x20be\x20added\x20and\x20balance\x20withdrawn.','related_errors':['E_GUARD_LOCKED_TIME','E_GUARD_LOCKED_TIME_NOT_INCREASING','E_GUARD_LOCKED_TIME_INVALID']},{'name':'record','move_type':'ParentTable<address,\x20RecipientRecord>','mutability':'runtime','set_at_creation':!![],'constraint':'Per-recipient\x20claim\x20history.\x20Each\x20RecipientRecord.amount\x20vector\x20has\x20length\x20<\x20MAX_RECORD_COUNT\x20(5200);\x20E_RECORD_COUNT_EXCEEDED\x20on\x20overflow.','related_errors':['E_RECORD_COUNT_EXCEEDED']},{'name':'um','move_type':'Option<address>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x9d,'constraint':'Option<Contact\x20address>.\x20Binding\x20creates\x20an\x20object-linker\x20core\x20binding;\x20unbinding\x20disaffiliates.'},{'name':'permission','move_type':'address','mutability':'admin_mutable','set_at_creation':!![],'constraint':'Permission\x20object\x20address.\x20Updated\x20owner-only\x20(asserts\x20old.owner\x20==\x20sender);\x20the\x20change\x20is\x20registered\x20as\x20an\x20object-linker\x20affiliation\x20change.'}];export const REWARD_GUARD_CONSTRUCTORS=[{'constructor':'dynamic_recipient_dynamic_amount','recipient_type':'GuardIdentifier','amount_type':'GuardU64Identifier','params':{'recipient_param':'u8','amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['recipient\x20identifier\x20must\x20resolve\x20to\x20an\x20address\x20in\x20the\x20Passport\x20table\x20—\x20E_RECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(4)','amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Dynamic\x20recipient\x20+\x20dynamic\x20amount\x20—\x20both\x20extracted\x20from\x20Passport\x20at\x20claim\x20time\x20(e.g.\x20referral\x20rewards\x20where\x20referrer\x20and\x20amount\x20vary\x20per\x20claim).'},{'constructor':'dynamic_recipient_fixed_amount','recipient_type':'GuardIdentifier','amount_type':'Fixed','params':{'recipient_param':'u8','amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['recipient\x20identifier\x20must\x20resolve\x20to\x20an\x20address\x20in\x20the\x20Passport\x20table\x20—\x20E_RECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(4)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Dynamic\x20recipient\x20+\x20fixed\x20amount\x20—\x20e.g.\x20first-order\x20reward\x20where\x20any\x20new\x20customer\x20claims\x20a\x20fixed\x201\x20WOW.'},{'constructor':'entity_recipient_dynamic_amount','recipient_type':'Entity','amount_type':'GuardU64Identifier','params':{'recipient_param':'address','amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Fixed\x20recipient\x20+\x20dynamic\x20amount\x20—\x20e.g.\x20tiered\x20loyalty\x20reward\x20where\x20amount\x20depends\x20on\x20Passport\x20submission\x20(tier\x20level).'},{'constructor':'entity_recipient_fixed_amount','recipient_type':'Entity','amount_type':'Fixed','params':{'recipient_param':'address','amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Fully\x20fixed\x20recipient\x20+\x20amount\x20—\x20simplest\x20configuration\x20(e.g.\x20specific\x20partner\x20bounty).'},{'constructor':'caller_recipient_dynamic_amount','recipient_type':'Signer','amount_type':'GuardU64Identifier','params':{'amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Caller\x20is\x20recipient\x20+\x20dynamic\x20amount\x20—\x20e.g.\x20self-service\x20claim\x20where\x20amount\x20depends\x20on\x20Passport\x20submission\x20(e.g.\x20cashback\x20rate).'},{'constructor':'caller_recipient_fixed_amount','recipient_type':'Signer','amount_type':'Fixed','params':{'amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Caller\x20is\x20recipient\x20+\x20fixed\x20amount\x20—\x20e.g.\x20flash\x20sale\x20where\x20any\x20eligible\x20caller\x20claims\x20a\x20fixed\x20reward.'}];export const REWARD_ERROR_CODES=[{'code':0x1,'name':'E_GUARD_LOCKED_TIME_NOT_INCREASING','description':'guard-lock\x20time\x20update:\x20new\x20time\x20<\x20current\x20clock\x20(must\x20be\x20≥\x20now)','trigger_operation':'guard-lock\x20time\x20update\x20(155)'},{'code':0x2,'name':'E_GUARD_EXPIRED','description':'guard_add\x20on\x20guard\x20with\x20expiration_time\x20<\x20now,\x20OR\x20claim\x20on\x20guard\x20with\x20expiration_time\x20<\x20now','trigger_operation':'guard_add\x20/\x20claim'},{'code':0x3,'name':'E_GUARD_COUNT_EXCEEDED','description':'guard_add\x20would\x20exceed\x20MAX_GUARD_COUNT=200\x20(only\x20on\x20NEW\x20guard,\x20not\x20on\x20update\x20of\x20existing)','trigger_operation':'guard_add'},{'code':0x4,'name':'E_RECIPIENT_IDENTIFIER_NOT_ADDRESS','description':'RewardGuard\x20constructor:\x20recipient\x20identifier\x20type\x20is\x20not\x20address\x20(GuardIdentifier\x20variant\x20only)','trigger_operation':'claim-guard\x20construction'},{'code':0x5,'name':'E_AMOUNT_NOT_U64','description':'RewardGuard\x20constructor:\x20amount\x20identifier\x20type\x20is\x20not\x20u64\x20(GuardU64Identifier\x20variant\x20only)','trigger_operation':'claim-guard\x20construction'},{'code':0x6,'name':'E_INSUFFICIENT_BALANCE','description':'claim:\x20balance\x20<\x20amount\x20(cannot\x20split\x20more\x20than\x20held)','trigger_operation':'claim'},{'code':0x7,'name':'E_GUARD_NOT_FOUND','description':'claim:\x20no\x20guard\x20in\x20self.guards\x20matches\x20the\x20supplied\x20guard\x20address','trigger_operation':'claim'},{'code':0x8,'name':'E_RECORD_COUNT_EXCEEDED','description':'claim:\x20recipient\x20already\x20has\x20MAX_RECORD_COUNT=5200\x20entries\x20(E_RECORD_COUNT_EXCEEDED)','trigger_operation':'claim'},{'code':0xa,'name':'E_GUARD_LOCKED_TIME','description':'guard_add\x20/\x20withdraw\x20while\x20guard_not_added_expiration_time\x20is\x20Some\x20and\x20clock\x20≤\x20expiration_time','trigger_operation':'guard_add\x20/\x20withdraw'},{'code':0xb,'name':'E_GUARD_LOCKED_TIME_INVALID','description':'guard-lock\x20time\x20update:\x20new\x20Some(t)\x20where\x20t\x20≤\x20now\x20(must\x20be\x20future)','trigger_operation':'guard-lock\x20time\x20update\x20(155)'},{'code':0xc,'name':'E_STORE_FROM_ID_NOT_COMPATIBLE','description':'RewardGuard\x20constructor:\x20store_from_id\x20identifier\x20type\x20is\x20not\x20number\x20or\x20address','trigger_operation':'claim-guard\x20construction'},{'code':0xd,'name':'E_CLAIM_ALREADY_MADE','description':'claim:\x20the\x20(recipient,\x20guard,\x20store_from\x20value)\x20once-slot\x20is\x20already\x20consumed\x20(MOV-PROTOCOL-1212\x20F-01\x20fix\x20—\x20replay\x20aborts,\x20the\x20pool\x20keeps\x20its\x20balance).\x20Empty\x20store_from\x20slot\x20=\x20once\x20per\x20(recipient,\x20guard);\x20a\x20store_from\x20value\x20pins\x20a\x20per-value\x20slot\x20(per-order\x20bounty)','trigger_operation':'claim'},{'code':0xe,'name':'E_CLAIM_RECIPIENT_NOT_SIGNER','description':'claim:\x20the\x20resolved\x20recipient\x20(from\x20guard\x20submissions\x20or\x20the\x20Entity\x20binding)\x20is\x20not\x20the\x20transaction\x20sender\x20(MOV-PROTOCOL-1212\x20B5\x20fix\x20—\x20an\x20attacker\x20cannot\x20route\x20a\x20reward\x20to\x20a\x20third\x20address).\x20Entity\x20flows\x20pass\x20because\x20the\x20SDK\x20replaces\x20the\x20sender\x20with\x20the\x20entity\x20account','trigger_operation':'claim'}];export const REWARD_SCENES=[{'id':'reward_first_order','name':'First-order\x20reward','industry':['universal','ecommerce','service','freelance'],'scenario':'New\x20customers\x20receive\x20a\x20fixed\x20reward\x20after\x20their\x20first\x20order.\x20Guard\x20verifies\x20order\x20ownership\x20+\x20first-time\x20status;\x20'+'Recipient=Signer\x20(caller\x20is\x20the\x20new\x20customer);\x20Amount=Fixed\x20(e.g.\x201\x20WOW).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin\x20(e.g.\x200x2::wow::WOW\x20or\x20a\x20custom\x20token)','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Signer\x20recipient\x20+\x20Fixed\x20amount\x20—\x20caller\x20claims\x20a\x20fixed\x20amount\x20(e.g.\x201\x20WOW)','Guard\x20verifies:\x20order_address.holder\x20==\x20signer\x20AND\x20order\x20is\x20the\x20first\x20order\x20(Repository\x20query)','expiration_time\x20bounds\x20the\x20campaign\x20window\x20(e.g.\x2030\x20days)','coin_add\x20deposits\x20the\x20campaign\x20budget\x20upfront\x20(e.g.\x20100\x20WOW\x20for\x20100\x20claims)'],'recommended_templates':['first_order']},{'id':'reward_referral','name':'Referral\x20viral\x20reward','industry':['universal','ecommerce','service','content'],'scenario':'Both\x20referrer\x20and\x20referee\x20receive\x20a\x20reward\x20when\x20the\x20referee\x20completes\x20a\x20first\x20order.\x20Two\x20guards:\x20one\x20for\x20referrer\x20(Entity),\x20one\x20for\x20referee\x20(Signer).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x2,'recipient_types_used':['Entity','Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':!![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Entity\x20recipient\x20+\x20Fixed\x20amount\x20for\x20the\x20referrer\x20(recipient\x20=\x20referrer\x20address)','Signer\x20recipient\x20+\x20Fixed\x20amount\x20for\x20the\x20referee\x20(caller\x20is\x20recipient)','Guard\x20verifies:\x20referrer\x20marked\x20in\x20Repository\x20AND\x20referee\x27s\x20order\x20completed','store_from_id\x20may\x20record\x20the\x20order\x20address\x20for\x20audit\x20trail'],'recommended_templates':['referral']},{'id':'reward_loyalty','name':'Loyalty\x20tiered\x20reward','industry':['universal','ecommerce','subscription','content'],'scenario':'Customers\x20unlock\x20higher\x20rewards\x20after\x20reaching\x20cumulative\x20spending\x20tiers.\x20Recipient=Signer;\x20Amount=GuardU64Identifier\x20(tier-dependent\x20amount\x20extracted\x20from\x20Passport).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['GuardU64Identifier'],'uses_expiration_time':![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Signer\x20recipient\x20+\x20identifier\x20amount\x20—\x20amount\x20is\x20dynamic,\x20extracted\x20from\x20Passport\x20submission\x20(tier\x20level\x20→\x20reward\x20amount)','Guard\x20verifies:\x20cumulative\x20spend\x20≥\x20tier\x20threshold\x20(Repository\x20query)','No\x20expiration_time\x20—\x20loyalty\x20is\x20perpetual\x20(until\x20deactivated\x20via\x20guard_remove)','Guard\x20submission\x20value\x20type\x20MUST\x20be\x20u64\x20(E_AMOUNT_NOT_U64\x20otherwise)'],'recommended_templates':['loyalty']},{'id':'reward_flash_sale','name':'Limited-time\x20flash\x20sale\x20reward','industry':['universal','ecommerce','retail'],'scenario':'Time-bounded\x20reward\x20for\x20the\x20first\x20N\x20callers.\x20Recipient=Signer;\x20Amount=Fixed.\x20Guard\x20verifies\x20time\x20window\x20+\x20claim\x20count.','phases':['creation','guard_addition','funds_replenish','claim','guard_lock_mgmt'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_GUARD_EXPIRATION_TIME_ADD],'common_patterns':['Signer\x20recipient\x20+\x20Fixed\x20amount\x20—\x20fixed\x20amount\x20per\x20claim\x20(e.g.\x202\x20WOW)','expiration_time\x20bounds\x20the\x20flash\x20sale\x20window\x20(e.g.\x2048\x20hours)','the\x20guard-addition\x20time-lock\x20(155)\x20may\x20lock\x20further\x20guard\x20additions\x20during\x20the\x20sale','Budget\x20=\x20max_claims\x20×\x20amount;\x20coin_add\x20deposits\x20this\x20upfront'],'recommended_templates':['flash_sale']},{'id':'reward_bulk_discount','name':'Bulk\x20discount\x20/\x20cashback\x20reward','industry':['universal','ecommerce','wholesale','service'],'scenario':'Customer\x20receives\x20cashback\x20proportional\x20to\x20order\x20size.\x20Recipient=Signer\x20or\x20Entity\x20(order\x20holder);\x20Amount=GuardU64Identifier\x20(cashback\x20rate\x20from\x20Passport).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20payment\x20coin\x20type\x20(must\x20match\x20order\x20payment\x20for\x20clean\x20cashback)','typical_guard_count':0x1,'recipient_types_used':['Signer','Entity'],'amount_types_used':['GuardU64Identifier'],'uses_expiration_time':![],'uses_store_from_id':!![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_RECEIVE],'common_patterns':['Signer\x20recipient\x20+\x20identifier\x20amount\x20—\x20caller\x20claims\x20dynamic\x20amount\x20(cashback\x20=\x20order_amount\x20×\x20rate)','store_from_id\x20records\x20the\x20order\x20address\x20for\x20cross-reference\x20(audit\x20trail)','receive\x20(154)\x20may\x20be\x20used\x20to\x20accept\x20CoinWrapper<T>\x20refunds\x20that\x20replenish\x20the\x20balance','Guard\x20verifies:\x20order.completed\x20AND\x20order.service\x20==\x20this\x20Service'],'recommended_templates':['cashback']},{'id':'reward_milestone','name':'Service\x20milestone\x20reward','industry':['universal','ecommerce','content','subscription'],'scenario':'When\x20a\x20Service\x20reaches\x20a\x20milestone\x20(e.g.\x20100\x20orders),\x20early\x20supporters\x20receive\x20extra\x20rewards.\x20Recipient=Entity\x20(early\x20customer);\x20Amount=Fixed.','phases':['creation','guard_addition','funds_replenish','claim','guard_lock_mgmt'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x32,'recipient_types_used':['Entity'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_GUARD_EXPIRATION_TIME_ADD],'common_patterns':['Entity\x20recipient\x20+\x20Fixed\x20amount\x20for\x20each\x20early\x20customer\x20(recipient\x20=\x20customer\x20address)','Multiple\x20guards\x20(up\x20to\x2050\x20for\x2050\x20early\x20supporters)\x20—\x20well\x20within\x20MAX_GUARD_COUNT=200','Guard\x20verifies:\x20Service\x20order_count\x20>=\x20milestone\x20AND\x20claimer\x20is\x20in\x20early-customer\x20list','the\x20guard-addition\x20time-lock\x20(155)\x20may\x20lock\x20the\x20guard\x20list\x20after\x20milestone\x20setup'],'recommended_templates':['milestone']}];export const REWARD_LEDGER_VERSION='1.0.0';export function getScenesByPhase(a){return REWARD_SCENES['filter'](b=>b['phases']['includes'](a));}export function findSceneById(a){return REWARD_SCENES['find'](b=>b['id']===a);}export function getScenesByIndustry(a){return REWARD_SCENES['filter'](b=>b['industry']['includes'](a)||b['industry']['includes']('universal'));}export function getBuiltinPermissionByIndex(a){return REWARD_PERMISSIONS['find'](b=>b['index']===a);}export function isRewardBuiltinPermission(a){return getBuiltinPermissionByIndex(a)!==undefined;}export function getAllBuiltinPermissions(){return[...REWARD_PERMISSIONS];}export function getRewardScenesCount(){return REWARD_SCENES['length'];}export function getGuardConstructorSpec(a){return REWARD_GUARD_CONSTRUCTORS['find'](b=>b['constructor']===a);}export function resolveGuardConstructor(a,b){const c={'GuardIdentifier|GuardU64Identifier':'dynamic_recipient_dynamic_amount','GuardIdentifier|Fixed':'dynamic_recipient_fixed_amount','Entity|GuardU64Identifier':'entity_recipient_dynamic_amount','Entity|Fixed':'entity_recipient_fixed_amount','Signer|GuardU64Identifier':'caller_recipient_dynamic_amount','Signer|Fixed':'caller_recipient_fixed_amount'};return c[a+'|'+b];}export function getRewardErrorByCode(a){return REWARD_ERROR_CODES['find'](b=>b['code']===a);}export function getRewardErrorByName(a){return REWARD_ERROR_CODES['find'](b=>b['name']===a);}export function validateGuardCount(a){if(a>=MAX_GUARD_COUNT_REWARD)return{'ok':![],'violation':'Guard\x20count\x20'+a+'\x20would\x20exceed\x20MAX_GUARD_COUNT_REWARD\x20'+MAX_GUARD_COUNT_REWARD};return{'ok':!![]};}export function validateRecordCount(a){if(a>=MAX_RECORD_COUNT_REWARD)return{'ok':![],'violation':'Record\x20count\x20'+a+'\x20would\x20exceed\x20MAX_RECORD_COUNT_REWARD\x20'+MAX_RECORD_COUNT_REWARD+'\x20—\x20recipient\x20can\x20no\x20longer\x20claim'};return{'ok':!![]};}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['flash\x20sale','reward_flash_sale'],['flash_sale','reward_flash_sale'],['limited-time','reward_flash_sale'],['limited\x20time','reward_flash_sale'],['referral','reward_referral'],['viral','reward_referral'],['refer\x20a\x20friend','reward_referral'],['invite','reward_referral'],['loyalty','reward_loyalty'],['tiered','reward_loyalty'],['tier','reward_loyalty'],['repeat','reward_loyalty'],['cashback','reward_bulk_discount'],['bulk\x20discount','reward_bulk_discount'],['bulk_discount','reward_bulk_discount'],['wholesale','reward_bulk_discount'],['milestone','reward_milestone'],['early\x20supporter','reward_milestone'],['early\x20customer','reward_milestone'],['first\x20order','reward_first_order'],['first_order','reward_first_order'],['new\x20customer','reward_first_order'],['first-time','reward_first_order']];for(const [d,e]of c){if(b['includes'](d)){const f=findSceneById(e);if(f)return f;}}return undefined;}export const REWARD_CROSS_OBJECT_REFS=[{'object':'Permission','phase':'universal','relationship':'Reward.permission\x20(address;\x20borrowed\x20for\x20all\x20150-157\x20assertions)'},{'object':'Permission','phase':'permission_update','relationship':'permission\x20update:\x20owner-only\x20(asserts\x20old.owner\x20==\x20sender);\x20registered\x20as\x20an\x20object-linker\x20affiliation\x20change'},{'object':'Guard','phase':'guard_addition','relationship':'RewardGuard.guard\x20=\x20guard.id_address\x20(each\x20guard\x20registered\x20via\x20object-linker\x20core\x20binding)'},{'object':'Guard','phase':'claim','relationship':'claim:\x20iterates\x20self.guards\x20looking\x20for\x20guard.id_address\x20match;\x20E_GUARD_NOT_FOUND\x20if\x20no\x20match'},{'object':'Guard','phase':'claim','relationship':'claim:\x20the\x20guard\x20verification\x20result\x20validates\x20the\x20Passport\x20submission\x20data'},{'object':'Passport','phase':'claim','relationship':'claim:\x20the\x20claimant\x27s\x20Passport\x20submission\x20supplies\x20the\x20recipient\x20(address)\x20and/or\x20amount\x20(u64)\x20per\x20RewardGuard\x20variant'},{'object':'Passport','phase':'claim','relationship':'claim:\x20if\x20store_from_id\x20is\x20Some,\x20extracts\x20store-from\x20address\x20from\x20Passport\x20submission'},{'object':'Payment','phase':'funds_replenish','relationship':'receive\x20(154):\x20unwraps\x20Coin<T>\x20from\x20CoinWrapper<T>\x20(with\x20check)\x20and\x20joins\x20the\x20balance'},{'object':'Payment','phase':'owner_receive','relationship':'owner\x20receipt\x20(156):\x20unwraps\x20CoinWrapper<K>\x20and\x20forwards\x20it\x20to\x20the\x20Permission\x20owner'},{'object':'Repository','phase':'claim','relationship':'Guard\x20may\x20query\x20Repository\x20(e.g.\x20order\x20history\x20for\x20first-order\x20/\x20loyalty\x20verification)'},{'object':'Service','phase':'claim','relationship':'Guard\x20may\x20verify\x20order.service\x20==\x20this\x20Service\x20(cashback\x20/\x20first-order\x20scenarios)'},{'object':'Demand','phase':'guard_addition','relationship':'Guard\x20may\x20be\x20shared\x20with\x20Demand\x20(recommendation\x20filtering);\x20same\x20Guard\x20object\x20address\x20space'},{'object':'Allocation','phase':'owner_receive','relationship':'Terminal\x20Allocation\x20alloc\x20may\x20route\x20funds\x20back\x20to\x20Reward\x20(replenishment\x20loop)'},{'object':'Contact','phase':'um_mgmt','relationship':'UM\x20binding\x20(157):\x20binds\x20Contact\x20(UM)\x20for\x20off-chain\x20coordination;\x20creates\x20object-linker\x20core\x20binding'},{'object':'Coin','phase':'universal','relationship':'Reward<phantom\x20T>:\x20T\x20is\x20the\x20coin\x20type;\x20balance:\x20Balance<T>;\x20coin_add\x20expects\x20Coin<T>'}];
|
|
1
|
+
import{MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD}from'./onchain-constants.js';export{MAX_GUARD_COUNT_REWARD,MAX_RECORD_COUNT_REWARD};export const REWARD_NEW={'index':0x96,'name':'REWARD_NEW','description':'Create\x20new\x20Reward<T>','governed_operations':['create\x20a\x20new\x20Reward\x20pool'],'sdk_exposed':!![]};export const REWARD_DESCRIPTION={'index':0x97,'name':'REWARD_DESCRIPTION','description':'Update\x20description','governed_operations':['update\x20the\x20Reward\x20description'],'sdk_exposed':!![]};export const REWARD_GUARD={'index':0x98,'name':'REWARD_GUARD','description':'Add\x20/\x20remove\x20expired\x20guards\x20(≤\x20MAX_GUARD_COUNT_REWARD=200)','governed_operations':['add\x20a\x20claim\x20guard\x20to\x20the\x20Reward','remove\x20expired\x20claim\x20guards'],'sdk_exposed':!![]};export const REWARD_COIN_ADD={'index':0x99,'name':'REWARD_COIN_ADD','description':'Deposit\x20Coin<T>\x20directly\x20into\x20Reward\x20balance\x20(joins\x20Balance<T>)','governed_operations':['deposit\x20Coin<T>\x20into\x20the\x20Reward\x20balance'],'sdk_exposed':!![]};export const REWARD_RECEIVE={'index':0x9a,'name':'REWARD_RECEIVE','description':'Receive\x20CoinWrapper<T>\x20into\x20the\x20balance\x20(unwrapped\x20with\x20balance\x20check)','governed_operations':['receive\x20a\x20CoinWrapper<T>\x20payment\x20into\x20the\x20balance'],'sdk_exposed':!![]};export const REWARD_GUARD_EXPIRATION_TIME_ADD={'index':0x9b,'name':'REWARD_GUARD_EXPIRATION_TIME_ADD','description':'Set\x20/\x20cancel\x20guard_not_added_expiration_time\x20(time-lock\x20on\x20new\x20guard\x20additions)','governed_operations':['set\x20or\x20cancel\x20the\x20time-lock\x20on\x20adding\x20new\x20guards'],'sdk_exposed':!![]};export const REWARD_OWNER_RECEIVE={'index':0x9c,'name':'REWARD_OWNER_RECEIVE','description':'Owner\x20receives\x20Receiving<K>\x20/\x20CoinWrapper<K>\x20at\x20terminal\x20state\x20(unwrap\x20→\x20owner)','governed_operations':['owner\x20receipt\x20of\x20payments\x20at\x20terminal\x20state\x20(unwrapped\x20to\x20the\x20owner)','owner\x20receipt\x20of\x20whole\x20objects\x20at\x20terminal\x20state'],'sdk_exposed':!![]};export const REWARD_UM={'index':0x9d,'name':'REWARD_UM','description':'Bind\x20/\x20unbind\x20Contact\x20(UM)\x20for\x20off-chain\x20coordination','governed_operations':['bind\x20a\x20Contact\x20as\x20the\x20UM\x20coordinator','unbind\x20the\x20UM\x20Contact'],'sdk_exposed':!![]};export const REWARD_WITHDRAW={'index':0x9e,'name':'REWARD_WITHDRAW','description':'Withdraw\x20balance\x20from\x20the\x20Reward\x20to\x20the\x20tx\x20sender\x20inside\x20a\x20Payment\x20object\x20receipt\x20(ETS-B,\x20the\x20only\x20non-claim\x20exit;\x20blocked\x20while\x20the\x20declared\x20no-guard\x20window\x20guard_not_added_expiration_time\x20is\x20in\x20the\x20future)','governed_operations':['withdraw\x20an\x20amount\x20from\x20the\x20Reward\x20balance,\x20delivered\x20to\x20the\x20executing\x20account\x20inside\x20a\x20Payment\x20object\x20(the\x20on-chain\x20receipt;\x20unwrap\x20mode\x20pays\x20the\x20coin\x20out\x20in\x20the\x20same\x20transaction)\x20(fails\x20with\x20E_GUARD_LOCKED_TIME\x20while\x20guard_not_added_expiration_time\x20is\x20in\x20the\x20future)'],'sdk_exposed':!![]};export const REWARD_PERMISSIONS=[REWARD_NEW,REWARD_DESCRIPTION,REWARD_GUARD,REWARD_COIN_ADD,REWARD_RECEIVE,REWARD_GUARD_EXPIRATION_TIME_ADD,REWARD_OWNER_RECEIVE,REWARD_UM,REWARD_WITHDRAW];export const REWARD_FIELDS=[{'name':'id','move_type':'UID','mutability':'immutable','set_at_creation':!![],'constraint':'Object\x20UID;\x20assigned\x20at\x20creation.\x20Never\x20changes.'},{'name':'description','move_type':'String','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x97,'constraint':'Must\x20satisfy\x20common::DESCRIPTION.\x20Updated\x20via\x20permission\x20151.'},{'name':'guards','move_type':'vector<RewardGuard>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x98,'constraint':'vector::length\x20<\x20MAX_GUARD_COUNT\x20(200);\x20E_GUARD_COUNT_EXCEEDED\x20on\x20overflow.','related_errors':['E_GUARD_COUNT_EXCEEDED']},{'name':'balance','move_type':'Balance<T>','mutability':'runtime','set_at_creation':!![],'constraint':'Zero\x20at\x20creation\x20(balance::zero());\x20grows\x20via\x20coin_add/receive;\x20shrinks\x20via\x20claim\x20(split)\x20and\x20via\x20withdraw\x20(ETS-B,\x20funds\x20leave\x20inside\x20a\x20Payment\x20object\x20receipt,\x20only\x20when\x20the\x20no-guard\x20window\x20has\x20elapsed).','related_errors':['E_INSUFFICIENT_BALANCE','E_GUARD_LOCKED_TIME']},{'name':'guard_not_added_expiration_time','move_type':'Option<u64>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x9b,'constraint':'Option<timestamp_ms>.\x20When\x20Some(t):\x20guard_add\x20AND\x20withdraw\x20require\x20clock\x20>\x20t\x20(E_GUARD_LOCKED_TIME).\x20When\x20None\x20or\x20t\x20<\x20now:\x20guards\x20can\x20be\x20added\x20and\x20balance\x20withdrawn.','related_errors':['E_GUARD_LOCKED_TIME','E_GUARD_LOCKED_TIME_NOT_INCREASING','E_GUARD_LOCKED_TIME_INVALID']},{'name':'record','move_type':'ParentTable<address,\x20RecipientRecord>','mutability':'runtime','set_at_creation':!![],'constraint':'Per-recipient\x20claim\x20history.\x20Each\x20RecipientRecord.amount\x20vector\x20has\x20length\x20<\x20MAX_RECORD_COUNT\x20(5200);\x20E_RECORD_COUNT_EXCEEDED\x20on\x20overflow.','related_errors':['E_RECORD_COUNT_EXCEEDED']},{'name':'um','move_type':'Option<address>','mutability':'admin_mutable','set_at_creation':!![],'permission_index':0x9d,'constraint':'Option<Contact\x20address>.\x20Binding\x20creates\x20an\x20object-linker\x20core\x20binding;\x20unbinding\x20disaffiliates.'},{'name':'permission','move_type':'address','mutability':'admin_mutable','set_at_creation':!![],'constraint':'Permission\x20object\x20address.\x20Updated\x20owner-only\x20(asserts\x20old.owner\x20==\x20sender);\x20the\x20change\x20is\x20registered\x20as\x20an\x20object-linker\x20affiliation\x20change.'}];export const REWARD_GUARD_CONSTRUCTORS=[{'constructor':'dynamic_recipient_dynamic_amount','recipient_type':'GuardIdentifier','amount_type':'GuardU64Identifier','params':{'recipient_param':'u8','amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['recipient\x20identifier\x20must\x20resolve\x20to\x20an\x20address\x20in\x20the\x20Passport\x20table\x20—\x20E_RECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(4)','amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Dynamic\x20recipient\x20+\x20dynamic\x20amount\x20—\x20both\x20extracted\x20from\x20Passport\x20at\x20claim\x20time\x20(e.g.\x20referral\x20rewards\x20where\x20referrer\x20and\x20amount\x20vary\x20per\x20claim).'},{'constructor':'dynamic_recipient_fixed_amount','recipient_type':'GuardIdentifier','amount_type':'Fixed','params':{'recipient_param':'u8','amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['recipient\x20identifier\x20must\x20resolve\x20to\x20an\x20address\x20in\x20the\x20Passport\x20table\x20—\x20E_RECIPIENT_IDENTIFIER_NOT_ADDRESS\x20(4)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Dynamic\x20recipient\x20+\x20fixed\x20amount\x20—\x20e.g.\x20first-order\x20reward\x20where\x20any\x20new\x20customer\x20claims\x20a\x20fixed\x201\x20WOW.'},{'constructor':'entity_recipient_dynamic_amount','recipient_type':'Entity','amount_type':'GuardU64Identifier','params':{'recipient_param':'address','amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Fixed\x20recipient\x20+\x20dynamic\x20amount\x20—\x20e.g.\x20tiered\x20loyalty\x20reward\x20where\x20amount\x20depends\x20on\x20Passport\x20submission\x20(tier\x20level).'},{'constructor':'entity_recipient_fixed_amount','recipient_type':'Entity','amount_type':'Fixed','params':{'recipient_param':'address','amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Fully\x20fixed\x20recipient\x20+\x20amount\x20—\x20simplest\x20configuration\x20(e.g.\x20specific\x20partner\x20bounty).'},{'constructor':'caller_recipient_dynamic_amount','recipient_type':'Signer','amount_type':'GuardU64Identifier','params':{'amount_param':'u8','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['amount\x20identifier\x20must\x20resolve\x20to\x20a\x20u64\x20Passport\x20value\x20—\x20E_AMOUNT_NOT_U64\x20(5)','if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Caller\x20is\x20recipient\x20+\x20dynamic\x20amount\x20—\x20e.g.\x20self-service\x20claim\x20where\x20amount\x20depends\x20on\x20Passport\x20submission\x20(e.g.\x20cashback\x20rate).'},{'constructor':'caller_recipient_fixed_amount','recipient_type':'Signer','amount_type':'Fixed','params':{'amount_param':'u64','expiration_time':'Option<u64>','store_from_id':'Option<u8>'},'construction_checks':['if\x20store_from_id\x20is\x20Some:\x20its\x20identifier\x20must\x20be\x20number/address\x20compatible\x20—\x20E_STORE_FROM_ID_NOT_COMPATIBLE\x20(12)'],'typical_use':'Caller\x20is\x20recipient\x20+\x20fixed\x20amount\x20—\x20e.g.\x20flash\x20sale\x20where\x20any\x20eligible\x20caller\x20claims\x20a\x20fixed\x20reward.'}];export const REWARD_ERROR_CODES=[{'code':0x1,'name':'E_GUARD_LOCKED_TIME_NOT_INCREASING','description':'guard-lock\x20time\x20update:\x20new\x20time\x20<\x20current\x20clock\x20(must\x20be\x20≥\x20now)','trigger_operation':'guard-lock\x20time\x20update\x20(155)'},{'code':0x2,'name':'E_GUARD_EXPIRED','description':'guard_add\x20on\x20guard\x20with\x20expiration_time\x20<\x20now,\x20OR\x20claim\x20on\x20guard\x20with\x20expiration_time\x20<\x20now','trigger_operation':'guard_add\x20/\x20claim'},{'code':0x3,'name':'E_GUARD_COUNT_EXCEEDED','description':'guard_add\x20would\x20exceed\x20MAX_GUARD_COUNT=200\x20(only\x20on\x20NEW\x20guard,\x20not\x20on\x20update\x20of\x20existing)','trigger_operation':'guard_add'},{'code':0x4,'name':'E_RECIPIENT_IDENTIFIER_NOT_ADDRESS','description':'RewardGuard\x20constructor:\x20recipient\x20identifier\x20type\x20is\x20not\x20address\x20(GuardIdentifier\x20variant\x20only)','trigger_operation':'claim-guard\x20construction'},{'code':0x5,'name':'E_AMOUNT_NOT_U64','description':'RewardGuard\x20constructor:\x20amount\x20identifier\x20type\x20is\x20not\x20u64\x20(GuardU64Identifier\x20variant\x20only)','trigger_operation':'claim-guard\x20construction'},{'code':0x6,'name':'E_INSUFFICIENT_BALANCE','description':'claim:\x20balance\x20<\x20amount\x20(cannot\x20split\x20more\x20than\x20held)','trigger_operation':'claim'},{'code':0x7,'name':'E_GUARD_NOT_FOUND','description':'claim:\x20no\x20guard\x20in\x20self.guards\x20matches\x20the\x20supplied\x20guard\x20address','trigger_operation':'claim'},{'code':0x8,'name':'E_RECORD_COUNT_EXCEEDED','description':'claim:\x20recipient\x20already\x20has\x20MAX_RECORD_COUNT=5200\x20entries\x20(E_RECORD_COUNT_EXCEEDED)','trigger_operation':'claim'},{'code':0xa,'name':'E_GUARD_LOCKED_TIME','description':'guard_add\x20/\x20withdraw\x20while\x20guard_not_added_expiration_time\x20is\x20Some\x20and\x20clock\x20≤\x20expiration_time','trigger_operation':'guard_add\x20/\x20withdraw'},{'code':0xb,'name':'E_GUARD_LOCKED_TIME_INVALID','description':'guard-lock\x20time\x20update:\x20new\x20Some(t)\x20where\x20t\x20≤\x20now\x20(must\x20be\x20future)','trigger_operation':'guard-lock\x20time\x20update\x20(155)'},{'code':0xc,'name':'E_STORE_FROM_ID_NOT_COMPATIBLE','description':'RewardGuard\x20constructor:\x20store_from_id\x20identifier\x20type\x20is\x20not\x20number\x20or\x20address','trigger_operation':'claim-guard\x20construction'},{'code':0xd,'name':'E_CLAIM_ALREADY_MADE','description':'claim:\x20the\x20once-slot\x20for\x20this\x20(guard,\x20store_from\x20value)\x20was\x20already\x20claimed\x20by\x20any\x20signer\x20—\x20first\x20come,\x20first\x20served\x20(MOV-PROTOCOL-1212\x20F-01\x20fix\x20—\x20replay\x20aborts,\x20the\x20pool\x20keeps\x20its\x20balance;\x20P155-08\x20v139:\x20a\x20stamped\x20slot\x20pins\x20the\x20key\x27s\x20recipient\x20axis\x20to\x20the\x20@0x0\x20sentinel,\x20so\x20the\x20once\x20domain\x20is\x20(guard,\x20store_from),\x20not\x20per-recipient).\x20Empty\x20store_from\x20slot\x20=\x20once\x20per\x20(recipient,\x20guard),\x20unchanged','trigger_operation':'claim'},{'code':0xe,'name':'E_CLAIM_RECIPIENT_NOT_SIGNER','description':'claim:\x20the\x20resolved\x20recipient\x20(from\x20guard\x20submissions\x20or\x20the\x20Entity\x20binding)\x20is\x20not\x20the\x20transaction\x20sender\x20(MOV-PROTOCOL-1212\x20B5\x20fix\x20—\x20an\x20attacker\x20cannot\x20route\x20a\x20reward\x20to\x20a\x20third\x20address).\x20Entity\x20flows\x20pass\x20because\x20the\x20SDK\x20replaces\x20the\x20sender\x20with\x20the\x20entity\x20account','trigger_operation':'claim'}];export const REWARD_SCENES=[{'id':'reward_first_order','name':'First-order\x20reward','industry':['universal','ecommerce','service','freelance'],'scenario':'New\x20customers\x20receive\x20a\x20fixed\x20reward\x20after\x20their\x20first\x20order.\x20Guard\x20verifies\x20order\x20ownership\x20+\x20first-time\x20status;\x20'+'Recipient=Signer\x20(caller\x20is\x20the\x20new\x20customer);\x20Amount=Fixed\x20(e.g.\x201\x20WOW).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin\x20(e.g.\x200x2::wow::WOW\x20or\x20a\x20custom\x20token)','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Signer\x20recipient\x20+\x20Fixed\x20amount\x20—\x20caller\x20claims\x20a\x20fixed\x20amount\x20(e.g.\x201\x20WOW)','Guard\x20verifies:\x20order_address.holder\x20==\x20signer\x20AND\x20order\x20is\x20the\x20first\x20order\x20(Repository\x20query)','expiration_time\x20bounds\x20the\x20campaign\x20window\x20(e.g.\x2030\x20days)','coin_add\x20deposits\x20the\x20campaign\x20budget\x20upfront\x20(e.g.\x20100\x20WOW\x20for\x20100\x20claims)'],'recommended_templates':['first_order']},{'id':'reward_referral','name':'Referral\x20viral\x20reward','industry':['universal','ecommerce','service','content'],'scenario':'Both\x20referrer\x20and\x20referee\x20receive\x20a\x20reward\x20when\x20the\x20referee\x20completes\x20a\x20first\x20order.\x20Two\x20guards:\x20one\x20for\x20referrer\x20(Entity),\x20one\x20for\x20referee\x20(Signer).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x2,'recipient_types_used':['Entity','Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':!![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Entity\x20recipient\x20+\x20Fixed\x20amount\x20for\x20the\x20referrer\x20(recipient\x20=\x20referrer\x20address)','Signer\x20recipient\x20+\x20Fixed\x20amount\x20for\x20the\x20referee\x20(caller\x20is\x20recipient)','Guard\x20verifies:\x20referrer\x20marked\x20in\x20Repository\x20AND\x20referee\x27s\x20order\x20completed','store_from_id\x20may\x20record\x20the\x20order\x20address\x20for\x20audit\x20trail'],'recommended_templates':['referral']},{'id':'reward_loyalty','name':'Loyalty\x20tiered\x20reward','industry':['universal','ecommerce','subscription','content'],'scenario':'Customers\x20unlock\x20higher\x20rewards\x20after\x20reaching\x20cumulative\x20spending\x20tiers.\x20Recipient=Signer;\x20Amount=GuardU64Identifier\x20(tier-dependent\x20amount\x20extracted\x20from\x20Passport).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['GuardU64Identifier'],'uses_expiration_time':![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD],'common_patterns':['Signer\x20recipient\x20+\x20identifier\x20amount\x20—\x20amount\x20is\x20dynamic,\x20extracted\x20from\x20Passport\x20submission\x20(tier\x20level\x20→\x20reward\x20amount)','Guard\x20verifies:\x20cumulative\x20spend\x20≥\x20tier\x20threshold\x20(Repository\x20query)','No\x20expiration_time\x20—\x20loyalty\x20is\x20perpetual\x20(until\x20deactivated\x20via\x20guard_remove)','Guard\x20submission\x20value\x20type\x20MUST\x20be\x20u64\x20(E_AMOUNT_NOT_U64\x20otherwise)'],'recommended_templates':['loyalty']},{'id':'reward_flash_sale','name':'Limited-time\x20flash\x20sale\x20reward','industry':['universal','ecommerce','retail'],'scenario':'Time-bounded\x20reward\x20for\x20the\x20first\x20N\x20callers.\x20Recipient=Signer;\x20Amount=Fixed.\x20Guard\x20verifies\x20time\x20window\x20+\x20claim\x20count.','phases':['creation','guard_addition','funds_replenish','claim','guard_lock_mgmt'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x1,'recipient_types_used':['Signer'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_GUARD_EXPIRATION_TIME_ADD],'common_patterns':['Signer\x20recipient\x20+\x20Fixed\x20amount\x20—\x20fixed\x20amount\x20per\x20claim\x20(e.g.\x202\x20WOW)','expiration_time\x20bounds\x20the\x20flash\x20sale\x20window\x20(e.g.\x2048\x20hours)','the\x20guard-addition\x20time-lock\x20(155)\x20may\x20lock\x20further\x20guard\x20additions\x20during\x20the\x20sale','Budget\x20=\x20max_claims\x20×\x20amount;\x20coin_add\x20deposits\x20this\x20upfront'],'recommended_templates':['flash_sale']},{'id':'reward_bulk_discount','name':'Bulk\x20discount\x20/\x20cashback\x20reward','industry':['universal','ecommerce','wholesale','service'],'scenario':'Customer\x20receives\x20cashback\x20proportional\x20to\x20order\x20size.\x20Recipient=Signer\x20or\x20Entity\x20(order\x20holder);\x20Amount=GuardU64Identifier\x20(cashback\x20rate\x20from\x20Passport).','phases':['creation','guard_addition','funds_replenish','claim'],'coin_type_note':'T\x20=\x20payment\x20coin\x20type\x20(must\x20match\x20order\x20payment\x20for\x20clean\x20cashback)','typical_guard_count':0x1,'recipient_types_used':['Signer','Entity'],'amount_types_used':['GuardU64Identifier'],'uses_expiration_time':![],'uses_store_from_id':!![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_RECEIVE],'common_patterns':['Signer\x20recipient\x20+\x20identifier\x20amount\x20—\x20caller\x20claims\x20dynamic\x20amount\x20(cashback\x20=\x20order_amount\x20×\x20rate)','store_from_id\x20records\x20the\x20order\x20address\x20for\x20cross-reference\x20(audit\x20trail)','receive\x20(154)\x20may\x20be\x20used\x20to\x20accept\x20CoinWrapper<T>\x20refunds\x20that\x20replenish\x20the\x20balance','Guard\x20verifies:\x20order.completed\x20AND\x20order.service\x20==\x20this\x20Service'],'recommended_templates':['cashback']},{'id':'reward_milestone','name':'Service\x20milestone\x20reward','industry':['universal','ecommerce','content','subscription'],'scenario':'When\x20a\x20Service\x20reaches\x20a\x20milestone\x20(e.g.\x20100\x20orders),\x20early\x20supporters\x20receive\x20extra\x20rewards.\x20Recipient=Entity\x20(early\x20customer);\x20Amount=Fixed.','phases':['creation','guard_addition','funds_replenish','claim','guard_lock_mgmt'],'coin_type_note':'T\x20=\x20project\x20reward\x20coin','typical_guard_count':0x32,'recipient_types_used':['Entity'],'amount_types_used':['Fixed'],'uses_expiration_time':!![],'uses_store_from_id':![],'builtin_indexes_consumed':[REWARD_NEW,REWARD_GUARD,REWARD_COIN_ADD,REWARD_GUARD_EXPIRATION_TIME_ADD],'common_patterns':['Entity\x20recipient\x20+\x20Fixed\x20amount\x20for\x20each\x20early\x20customer\x20(recipient\x20=\x20customer\x20address)','Multiple\x20guards\x20(up\x20to\x2050\x20for\x2050\x20early\x20supporters)\x20—\x20well\x20within\x20MAX_GUARD_COUNT=200','Guard\x20verifies:\x20Service\x20order_count\x20>=\x20milestone\x20AND\x20claimer\x20is\x20in\x20early-customer\x20list','the\x20guard-addition\x20time-lock\x20(155)\x20may\x20lock\x20the\x20guard\x20list\x20after\x20milestone\x20setup'],'recommended_templates':['milestone']}];export const REWARD_LEDGER_VERSION='1.0.0';export function getScenesByPhase(a){return REWARD_SCENES['filter'](b=>b['phases']['includes'](a));}export function findSceneById(a){return REWARD_SCENES['find'](b=>b['id']===a);}export function getScenesByIndustry(a){return REWARD_SCENES['filter'](b=>b['industry']['includes'](a)||b['industry']['includes']('universal'));}export function getBuiltinPermissionByIndex(a){return REWARD_PERMISSIONS['find'](b=>b['index']===a);}export function isRewardBuiltinPermission(a){return getBuiltinPermissionByIndex(a)!==undefined;}export function getAllBuiltinPermissions(){return[...REWARD_PERMISSIONS];}export function getRewardScenesCount(){return REWARD_SCENES['length'];}export function getGuardConstructorSpec(a){return REWARD_GUARD_CONSTRUCTORS['find'](b=>b['constructor']===a);}export function resolveGuardConstructor(a,b){const c={'GuardIdentifier|GuardU64Identifier':'dynamic_recipient_dynamic_amount','GuardIdentifier|Fixed':'dynamic_recipient_fixed_amount','Entity|GuardU64Identifier':'entity_recipient_dynamic_amount','Entity|Fixed':'entity_recipient_fixed_amount','Signer|GuardU64Identifier':'caller_recipient_dynamic_amount','Signer|Fixed':'caller_recipient_fixed_amount'};return c[a+'|'+b];}export function getRewardErrorByCode(a){return REWARD_ERROR_CODES['find'](b=>b['code']===a);}export function getRewardErrorByName(a){return REWARD_ERROR_CODES['find'](b=>b['name']===a);}export function validateGuardCount(a){if(a>=MAX_GUARD_COUNT_REWARD)return{'ok':![],'violation':'Guard\x20count\x20'+a+'\x20would\x20exceed\x20MAX_GUARD_COUNT_REWARD\x20'+MAX_GUARD_COUNT_REWARD};return{'ok':!![]};}export function validateRecordCount(a){if(a>=MAX_RECORD_COUNT_REWARD)return{'ok':![],'violation':'Record\x20count\x20'+a+'\x20would\x20exceed\x20MAX_RECORD_COUNT_REWARD\x20'+MAX_RECORD_COUNT_REWARD+'\x20—\x20recipient\x20can\x20no\x20longer\x20claim'};return{'ok':!![]};}export function inferSceneFromIntent(a){const b=a['toLowerCase'](),c=[['flash\x20sale','reward_flash_sale'],['flash_sale','reward_flash_sale'],['limited-time','reward_flash_sale'],['limited\x20time','reward_flash_sale'],['referral','reward_referral'],['viral','reward_referral'],['refer\x20a\x20friend','reward_referral'],['invite','reward_referral'],['loyalty','reward_loyalty'],['tiered','reward_loyalty'],['tier','reward_loyalty'],['repeat','reward_loyalty'],['cashback','reward_bulk_discount'],['bulk\x20discount','reward_bulk_discount'],['bulk_discount','reward_bulk_discount'],['wholesale','reward_bulk_discount'],['milestone','reward_milestone'],['early\x20supporter','reward_milestone'],['early\x20customer','reward_milestone'],['first\x20order','reward_first_order'],['first_order','reward_first_order'],['new\x20customer','reward_first_order'],['first-time','reward_first_order']];for(const [d,e]of c){if(b['includes'](d)){const f=findSceneById(e);if(f)return f;}}return undefined;}export const REWARD_CROSS_OBJECT_REFS=[{'object':'Permission','phase':'universal','relationship':'Reward.permission\x20(address;\x20borrowed\x20for\x20all\x20150-157\x20assertions)'},{'object':'Permission','phase':'permission_update','relationship':'permission\x20update:\x20owner-only\x20(asserts\x20old.owner\x20==\x20sender);\x20registered\x20as\x20an\x20object-linker\x20affiliation\x20change'},{'object':'Guard','phase':'guard_addition','relationship':'RewardGuard.guard\x20=\x20guard.id_address\x20(each\x20guard\x20registered\x20via\x20object-linker\x20core\x20binding)'},{'object':'Guard','phase':'claim','relationship':'claim:\x20iterates\x20self.guards\x20looking\x20for\x20guard.id_address\x20match;\x20E_GUARD_NOT_FOUND\x20if\x20no\x20match'},{'object':'Guard','phase':'claim','relationship':'claim:\x20the\x20guard\x20verification\x20result\x20validates\x20the\x20Passport\x20submission\x20data'},{'object':'Passport','phase':'claim','relationship':'claim:\x20the\x20claimant\x27s\x20Passport\x20submission\x20supplies\x20the\x20recipient\x20(address)\x20and/or\x20amount\x20(u64)\x20per\x20RewardGuard\x20variant'},{'object':'Passport','phase':'claim','relationship':'claim:\x20if\x20store_from_id\x20is\x20Some,\x20extracts\x20store-from\x20address\x20from\x20Passport\x20submission'},{'object':'Payment','phase':'funds_replenish','relationship':'receive\x20(154):\x20unwraps\x20Coin<T>\x20from\x20CoinWrapper<T>\x20(with\x20check)\x20and\x20joins\x20the\x20balance'},{'object':'Payment','phase':'owner_receive','relationship':'owner\x20receipt\x20(156):\x20unwraps\x20CoinWrapper<K>\x20and\x20forwards\x20it\x20to\x20the\x20Permission\x20owner'},{'object':'Repository','phase':'claim','relationship':'Guard\x20may\x20query\x20Repository\x20(e.g.\x20order\x20history\x20for\x20first-order\x20/\x20loyalty\x20verification)'},{'object':'Service','phase':'claim','relationship':'Guard\x20may\x20verify\x20order.service\x20==\x20this\x20Service\x20(cashback\x20/\x20first-order\x20scenarios)'},{'object':'Demand','phase':'guard_addition','relationship':'Guard\x20may\x20be\x20shared\x20with\x20Demand\x20(recommendation\x20filtering);\x20same\x20Guard\x20object\x20address\x20space'},{'object':'Allocation','phase':'owner_receive','relationship':'Terminal\x20Allocation\x20alloc\x20may\x20route\x20funds\x20back\x20to\x20Reward\x20(replenishment\x20loop)'},{'object':'Contact','phase':'um_mgmt','relationship':'UM\x20binding\x20(157):\x20binds\x20Contact\x20(UM)\x20for\x20off-chain\x20coordination;\x20creates\x20object-linker\x20core\x20binding'},{'object':'Coin','phase':'universal','relationship':'Reward<phantom\x20T>:\x20T\x20is\x20the\x20coin\x20type;\x20balance:\x20Balance<T>;\x20coin_add\x20expects\x20Coin<T>'}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const BUYER_ACTION_NODE_RE=/^(reviewed|return_requested|guest_cancelled|withdrawn|charging|cancelled|closed_cancel)$/i;export function unannotatedBuyerActionNodes(a){return a['filter'](b=>!b['operator']&&BUYER_ACTION_NODE_RE['test'](b['name']))['map'](b=>b['name']);}export const SCENARIO_MODES=[{'name':'freelance','phase':0x1,'industry':'Design\x20/\x20dev\x20/\x20consulting\x20/\x20writing','trust_pattern':'Milestone\x20allocation,\x20acceptance\x20gate','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'freelance/enterprise-talent-market','key_risk':'Customer\x20never\x20accepts\x20delivery\x20—\x20provider\x20cannot\x20get\x20paid','build_notes':['Use\x20Service\x20`setting_lock_duration`\x20to\x20lock\x20rules\x20for\x20the\x20engagement\x20duration','WIP\x20hash\x20on\x20every\x20milestone\x20deliverable\x20is\x20mandatory\x20—\x20protects\x20provider\x20in\x20disputes','Acceptance\x20gate\x20is\x20the\x20trust\x20pivot\x20—\x20both\x20parties\x20must\x20agree\x20on\x20criteria\x20per\x20milestone','Milestones\x20map\x20to\x20deliverable-Guarded\x20forwards;\x20each\x20accepted\x20milestone\x20releases\x20its\x20escrowed\x20slice\x20(allocation.distribute_milestone)','Scope\x20changes\x20are\x20recorded\x20as\x20WTS\x20change-requests\x20at\x20kickoff/throughout\x20—\x20never\x20silent','R-M1-11:\x20no\x20\x27refunded\x27/\x27disputed\x27/\x27arb\x27/\x27cancelled\x27\x20nodes\x20—\x20refunds\x20route\x20via\x20Allocator\x20(to\x20OrderHolder)\x20triggered\x20by\x20\x27closed_cancel\x27,\x20disputes\x20via\x20Arbitration','Payment\x20exception\x20compensation\x20for\x20delivery\x20delays\x20—\x20provider\x20Treasury\x20auto-compensates\x20customer\x20(§2.13)','Project-Catalog\x20orders\x20have\x20NO\x20milestones\x20(single\x20funded\x20order\x20+\x20steps\x20timeline);\x20milestones\x20here\x20model\x20fixed-price\x20CONTRACTS.\x20For\x20catalog-style\x20listings\x20(tiered\x20pricing\x20+\x20add-ons\x20+\x20buyer\x20requirements)\x20use\x20the\x20freelance/catalog-tiers\x20template\x20instead','Time-bound\x20catalog\x20rules\x20(24h\x20instant\x20cancel,\x2048h\x20requirements\x20timeout,\x2014-day\x20auto-accept)\x20need\x20a\x20time\x20Guard\x20PLUS\x20an\x20off-chain\x20keeper\x20per\x20window\x20-\x20Guards\x20take\x20an\x20immutable\x20duration\x20constant']},{'name':'rental','phase':0x1,'industry':'Equipment\x20/\x20vehicle\x20/\x20property\x20rental','trust_pattern':'Deposit\x20escrow,\x20return\x20inspection','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':!![],'multi_tier_allocation':![]},'default_template':'rental/institutional-longstay','key_risk':'Owner\x20claims\x20damage\x20without\x20pre-rental\x20WIP\x20—\x20customer\x20loses\x20deposit\x20unfairly','build_notes':['Pre-rental\x20WIP\x20is\x20non-negotiable\x20—\x20without\x20it,\x20damage\x20claims\x20fail','Deposit\x20must\x20be\x20escrowed,\x20not\x20direct-transferred\x20—\x20enables\x20fair\x20deduction','Inspection\x20gate\x20prevents\x20customer\x20from\x20denying\x20damage','Overdue\x20handling\x20uses\x20a\x20time-lock\x20Guard\x20(clock)\x20—\x20the\x20Guard\x20only\x20ALLOWS\x20the\x20overdue\x20transition;\x20automatic\x20advancement\x20needs\x20an\x20off-chain\x20keeper\x20(see\x20DESIGN-REVIEW\x20C-3)','Extensions\x20are\x20modeled\x20as\x20separate\x20sub-orders\x20(REUSE\x20pattern),\x20not\x20as\x20machine\x20cycles\x20—\x20an\x20in-order\x20loop\x20replays\x20its\x20forwards\x27\x20fund\x20rails\x20every\x20lap','R-M1-11:\x20no\x20\x27deposit_refunded\x27/\x27deposit_deducted\x27/\x27refunded\x27\x20nodes\x20—\x20deposit\x20refund/deduction\x20flows\x20through\x20Allocator\x20triggered\x20by\x20return_approved/damage_confirmed\x20business\x20states','Payment\x20exception\x20compensation\x20for\x20return\x20delays\x20—\x20Treasury\x20withdraws\x20scene-bound\x20Payment\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/usage\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'education','phase':0x2,'industry':'Courses\x20/\x20training\x20/\x20tutoring','trust_pattern':'Periodic\x20release\x20per\x20session,\x20attendance\x20Guard','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':![]},'default_template':'education/live-class-cohort','key_risk':'Tutoring\x20institutions\x20run\x20away\x20with\x20prepaid\x20tuition','build_notes':['Use\x20Service\x20`setting_lock_duration`\x20to\x20lock\x20rules\x20for\x20the\x20entire\x20term\x20(regulatory\x20compliance,\x20>=90d)','Attendance\x20Guard\x20needs\x20WIP\x20hash\x20for\x20session\x20content\x20commitment;\x20attendance\x20evidence\x20lives\x20in\x20the\x20class\x20Repository','Per-session\x20release\x20requires\x20threshold-based\x20trigger\x20—\x20each\x20attended\x20session\x20releases\x201/N','session_1..session_3\x20are\x20representative\x20—\x20configure\x20the\x20real\x20session\x20count\x20(session_N)\x20at\x20build\x20time;\x20each\x20session\x20=\x20one\x20attendance-Guarded\x20forward','Pause/deferral\x20is\x20a\x20terminal\x20node\x20+\x20new\x20sub-order\x20(REUSE\x20pattern)\x20—\x20never\x20a\x20loop\x20back\x20into\x20the\x20session\x20chain\x20(a\x20loop\x20replays\x20the\x20session\x20forwards\x27\x20fund\x20rails\x20every\x20lap;\x20if\x20a\x20loop\x20is\x20unavoidable\x20it\x20must\x20keep\x20a\x20cycle-breaking\x20exit)','Supply\x20chain\x20sub-orders\x20for\x20course\x20module\x20progressive\x20unlock\x20—\x20each\x20module\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20previous\x20module\x20completion\x20(§2.12)','Repository\x20for\x20learning\x20progress\x20collaboration\x20data\x20—\x20progress\x20as\x20key,\x20session\x20data\x20as\x20value\x20(§2.10)']},{'name':'travel','phase':0x2,'industry':'Custom\x20tours\x20/\x20multi-segment\x20trips','trust_pattern':'Multi-tier\x20allocation\x20per\x20segment','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'travel/destination-experience','key_risk':'Paid\x20in\x20full\x20then\x20service\x20shrinks\x20—\x20multi-tier\x20transparency\x20prevents\x20this','build_notes':['Multi-tier\x20Allocation\x20is\x20WoWok\x27s\x20unique\x20advantage\x20over\x20traditional\x20travel\x20platforms','segment_guard\x20needs\x20standardized\x20WIP\x20templates\x20per\x20segment\x20type\x20(hotel,\x20transport,\x20activity)','Multi-tier\x20waterfall\x20needs\x20guard\x20chaining\x20validation','Weather/force-majeure\x20branches\x20enter\x20reschedule\x20(terminal)\x20or\x20partial-refund\x20interrupted\x20terminal\x20—\x20never\x20loop\x20back\x20into\x20the\x20segment\x20chain\x20(a\x20loop\x20replays\x20the\x20segment\x20forwards\x27\x20fund\x20rails\x20every\x20lap;\x20if\x20a\x20loop\x20is\x20unavoidable\x20it\x20must\x20keep\x20a\x20cycle-breaking\x20exit)','Supplier\x20sub-orders\x20each\x20carry\x20their\x20own\x20machine\x20—\x20hotel/guide/driver\x20fulfill\x20independently\x20(§2.12)','Supply\x20chain\x20sub-orders\x20—\x20each\x20tour\x20segment\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20main\x20tour\x20order\x20(§2.12)','Payment\x20exception\x20compensation\x20for\x20flight/segment\x20delays\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/travel\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'subscription','phase':0x3,'industry':'SaaS\x20/\x20content\x20membership\x20/\x20periodic\x20service','trust_pattern':'Periodic\x20charge,\x20cancel\x20Guard','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'subscription/creator-membership','key_risk':'Auto-renew\x20trap\x20and\x20platform-takes-30%\x20—\x20WoWok\x20native\x20solution','build_notes':['Pure\x20digital\x20—\x20native\x20WoWok\x20soil','charge_guard\x20needs\x20periodic\x20trigger\x20(off-chain\x20scheduler\x20+\x20on-chain\x20Guard)','Renewal\x20is\x20an\x20explicit\x20buyer-side\x20forward\x20(or\x20a\x20Guard-gated\x20auto-renew\x20WITH\x20WTS\x20notice)\x20—\x20never\x20silent','Cancellation\x20is\x20frictionless\x20and\x20next-period\x20effective;\x20pro-rata\x20refund\x20for\x20unearned\x20periods','Forbid\x20dead-end\x20nodes\x20(prevent\x20lock-in);\x20every\x20state\x20must\x20have\x20a\x20forward\x20or\x20be\x20an\x20intended\x20terminal','Targets\x20indie\x20creators,\x20niche\x20SaaS,\x20paid\x20newsletters','Repository\x20quote_guard\x20for\x20creator\x20data\x20subscription\x20revenue\x20—\x20creators\x20publish\x20paid\x20data,\x20users\x20pay\x20to\x20access\x20(§2.11)']},{'name':'retail','phase':0x1,'industry':'Goods\x20retail\x20/\x20marketplace\x20/\x20e-commerce','trust_pattern':'Escrow\x20+\x20confirm-on-receipt\x20release','traits':{'has_logistics':!![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'retail/scale-marketplace','key_risk':'Products\x20don\x27t\x20match\x20description\x20—\x20no\x20refund\x20path\x20for\x20returns','build_notes':['Logistics\x20WIP\x20(tracking\x20number)\x20is\x20essential\x20—\x20shipping\x20evidence\x20protects\x20both\x20parties\x20in\x20return\x20disputes','Confirm\x20gate\x20prevents\x20merchant\x20from\x20self-confirming\x20receipt','Refund\x20path\x20must\x20support\x20return-and-exchange\x20flow;\x20refund_window\x20>=\x207d','Return\x20request\x20is\x20time-lock\x20gated\x20—\x20after\x20the\x20window\x20closes,\x20returns\x20need\x20merchant\x20permission\x20or\x20arbitration','Compensation\x20fund\x20covers\x20return/exchange\x20disputes','R-M1-11:\x20no\x20\x27refunded\x27\x20node\x20—\x20refunds\x20route\x20via\x20Allocator\x20triggered\x20by\x20returned/cancelled\x20business\x20states;\x20disputes\x20go\x20to\x20Arbitration']},{'name':'licensing','phase':0x1,'industry':'IP\x20/\x20royalty\x20licensing\x20/\x20metered\x20asset\x20licenses','trust_pattern':'Terms\x20hash-anchored,\x20on-chain\x20royalty\x20split,\x20territory/term\x20Guard','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':!![]},'default_template':'licensing/royalty-stream-auction','key_risk':'Buyer\x20trusts\x20the\x20seller\x27s\x20royalty/usage\x20reporting\x20—\x20without\x20an\x20on-chain\x20meter\x20the\x20accounting\x20honesty\x20is\x20only\x20as\x20good\x20as\x20the\x20attestation\x20and\x20the\x20compensation\x20backstop','build_notes':['Anchor\x20the\x20license\x20terms\x20(territory,\x20term,\x20media,\x20caps,\x20exclusivity)\x20as\x20a\x20WIP\x20hash\x20—\x20the\x20granted\x20rights\x20must\x20be\x20provable\x20in\x20a\x20dispute,\x20not\x20prose','Royalty\x20/\x20purchase-proceeds\x20split\x20is\x20an\x20Allocation\x20Rate\x20plan\x20(bps\x20summing\x20to\x2010000\x20across\x20rights-holders\x20+\x20platform);\x20the\x20split\x20is\x20frozen\x20at\x20publish\x20and\x20auditable\x20by\x20every\x20recipient','Recurring\x20royalty:\x20the\x20Allocation\x20pool\x20is\x20re-fillable\x20(order_renew\x20top-ups)\x20and\x20a\x20guard-keyed\x20periodic\x20alloc\x20with\x20a\x20period-N\x20once-key\x20(identifier\x20255)\x20releases\x20each\x20period\x20—\x20payroll-style\x20repeat\x20runs\x20stay\x20possible\x20without\x20the\x20once-slot','Territory\x20is\x20enforced\x20by\x20a\x20Service\x20buy_guard\x20running\x20pattern.identity_check_allowlist\x20(allowlist\x20as\x20an\x20Address-vector\x20table\x20constant);\x20term\x20/\x20inspection\x20window\x20is\x20a\x20tpl_time_lock_progress\x20forward\x20guard\x20(Clock\x20>=\x20entry_time\x20+\x20duration)','Time-lock\x20duration\x20is\x20an\x20IMMUTABLE\x20table\x20constant\x20fixed\x20at\x20publish\x20—\x20an\x20expired\x20window\x20only\x20BLOCKS\x20the\x20forward,\x20it\x20never\x20auto-refunds;\x20automatic\x20advancement\x20on\x20timeout\x20needs\x20an\x20off-chain\x20keeper','🔴\x20AUCTION\x20GAP:\x20there\x20is\x20NO\x20on-chain\x20ascending-auction\x20/\x20bid-ledger\x20/\x20highest-bidder\x20primitive.\x20Model\x20a\x20competitive\x20sale\x20as:\x20winner\x20resolved\x20OFF-CHAIN\x20(prose),\x20then\x20the\x20winner\x20calls\x20buy\x20like\x20any\x20buyer\x20—\x20optionally\x20gate\x20buy\x20with\x20an\x20allowlist\x20guard\x20carrying\x20the\x20attested\x20winner\x20address.\x20Never\x20claim\x20the\x20chain\x20runs\x20the\x20auction','🔴\x20METERED-CAPS\x20GAP:\x20there\x20is\x20NO\x20usage\x20oracle/meter.\x20A\x20\x27limited\x20to\x20N\x20streams/sales\x27\x20cap\x20can\x20only\x20be\x20an\x20ATTESTED\x20Repository\x20counter\x20that\x20a\x20forward\x20guard\x20reads\x20via\x20the\x20repository.data\x20count-where\x20query\x20—\x20the\x20count\x20is\x20only\x20as\x20trustworthy\x20as\x20its\x20write-guard\x20(self/attested),\x20never\x20an\x20oracle\x20feed.\x20Disclose\x20this\x20honestly;\x20never\x20present\x20a\x20cap\x20as\x20chain-enforced\x20metering','R-M1-11:\x20no\x20\x27refunded\x27/\x27cancelled\x27\x20fund\x20terminals\x20—\x20refunds\x20route\x20via\x20the\x20Allocator\x20triggered\x20by\x20a\x20business\x20state\x20(e.g.\x20inspection_failed);\x20disputes\x20go\x20to\x20Arbitration']},{'name':'crowdfunding','phase':0x1,'industry':'All-or-nothing\x20threshold\x20campaigns\x20/\x20flexible\x20keep-it-all\x20fundraising','trust_pattern':'Per-contributor\x20escrow\x20(unpooled)\x20+\x20on-chain\x20aggregate\x20threshold\x20+\x20deadline\x20two-leg\x20release/refund','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':!![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'crowdfunding/all-or-nothing-threshold','key_risk':'The\x20funding\x20threshold\x20is\x20an\x20aggregate\x20read\x20over\x20a\x20shared\x20campaign\x20ledger\x20—\x20each\x20contribution\x20row\x20is\x20writer-bound\x20to\x20its\x20funder,\x20but\x20the\x20aggregate\x20is\x20a\x20read-only\x20sum\x20of\x20declared\x20rows,\x20not\x20an\x20independent\x20re-computation\x20of\x20every\x20escrow;\x20roster\x20completeness\x20is\x20keeper-attested.\x20Funders\x20also\x20trust\x20eventual\x20project\x20delivery,\x20backed\x20only\x20by\x20compensation_fund\x20+\x20arbitration','build_notes':['Per-contributor\x20escrow,\x20NEVER\x20pooled:\x20each\x20funder\x27s\x20Order\x20holds\x20its\x20OWN\x20Allocation\x20with\x20payment_info.for_object\x20bound\x20to\x20that\x20Order\x20—\x20because\x20the\x20money\x20is\x20never\x20balance::join-ed\x20into\x20one\x20pot,\x20attribution\x20survives\x20and\x20each\x20contribution\x20is\x20refundable\x20to\x20its\x20own\x20funder','Threshold\x20gate\x20=\x20an\x20on-chain\x20aggregate:\x20a\x20shared\x20campaign\x20Repository\x20holds\x20one\x20numeric\x20row\x20per\x20contribution\x20(keyed\x20by\x20the\x20contribution,\x20tagged\x20with\x20a\x20campaign\x20id);\x20the\x20settlement\x20Guard\x20reads\x20it\x20back\x20with\x20the\x20repository.data\x20sum-where\x20query\x20(1174\x20→\x20U256,\x20overflow-safe)\x20and\x20compares\x20against\x20the\x20threshold\x20constant','Write-side\x20binding\x20is\x20MANDATORY:\x20contribution\x20rows\x20are\x20written\x20under\x20pattern.repository_write_authorization\x20with\x20an\x20identity\x20leaf\x20(order.owner\x20==\x20Signer\x20/\x20order.agent\x20has\x20Signer)\x20so\x20a\x20funder\x20can\x20only\x20record\x20their\x20OWN\x20contribution\x20—\x20existence-is-not-trust\x20(R-X1-17),\x20an\x20unbound\x20write_guard\x20makes\x20the\x20aggregate\x20forgeable','Deadline\x20=\x20a\x20time-lock:\x20both\x20settlement\x20legs\x20require\x20Clock\x20>=\x20deadline\x20via\x20pattern.time_lock_progress\x20(query\x201280,\x20node-ENTRY\x20anchored);\x20BEFORE\x20the\x20deadline\x20a\x20funder\x20may\x20withdraw\x20(buyer-self-service\x20withdrawn\x20rail:\x20removes\x20their\x20writer-bound\x20row\x20+\x20full\x20refund\x20—\x20A12\x20fix,\x20was\x20wrongly\x20\x27no\x20early\x20withdrawal\x27);\x20AFTER\x20the\x20deadline\x20funds\x20are\x20committed\x20to\x20the\x20threshold\x20outcome','Two-leg\x20escrow\x20exit\x20(D-BUG-2\x20polarity):\x20release\x20leg\x20(→\x20project\x20Entity)\x20gated\x20logic_and[sum_where\x20>=\x20threshold,\x20clock\x20>=\x20deadline];\x20refund\x20leg\x20(→\x20for_object,\x20the\x20funder\x27s\x20own\x20Order)\x20gated\x20logic_and[sum_where\x20<\x20threshold,\x20clock\x20>=\x20deadline]\x20—\x20mutually\x20exclusive\x20on\x20the\x20aggregate\x20comparison,\x20so\x20exactly\x20one\x20is\x20satisfiable\x20once\x20the\x20deadline\x20passes','Keeper\x20batch\x20settlement:\x20on\x20a\x20missed\x20campaign\x20a\x20keeper\x20enumerates\x20every\x20contributor\x20via\x20repository.data\x20find-where\x20(1176\x20→\x20VectorAddress)\x20/\x20keys-where\x20(1177\x20→\x20VectorString)\x20and\x20advances\x20each\x20funder\x27s\x20refund\x20leg\x20in\x20one\x20PTB\x20(or\x20N\x20PTBs)\x20—\x20an\x20ops\x20efficiency,\x20not\x20a\x20chain\x20capability','🔴\x20AGGREGATE\x20TRUST\x20BOUNDARY:\x20the\x20sum\x20is\x20only\x20as\x20honest\x20as\x20the\x20writer-bound\x20rows;\x20it\x20is\x20NOT\x20independently\x20re-derivable\x20on-chain\x20without\x20reading\x20every\x20escrow\x20balance.\x20Disclose\x20this\x20honestly\x20(L-04);\x20never\x20present\x20the\x20threshold\x20as\x20a\x20chain-verified\x20total-custody\x20proof','🔴\x20L-01\x20NON-INVESTMENT:\x20crowdfunding\x20copy\x20must\x20never\x20promise\x20investment\x20returns,\x20yield,\x20or\x20token-price\x20appreciation\x20—\x20it\x20is\x20a\x20threshold\x20purchase/preorder/donation,\x20not\x20a\x20security','🔴\x20L-05\x20KYC/AML:\x20pooled\x20fundraising\x20is\x20high\x20regulatory\x20intensity\x20—\x20cross-border\x20funds\x20and\x20reward\x20tiers\x20may\x20trigger\x20securities/money-transmission\x20rules;\x20flag\x20for\x20compliance,\x20do\x20not\x20automate\x20around\x20them','R-M1-11:\x20no\x20\x27refunded\x27/\x27cancelled\x27\x20fund\x20terminals\x20—\x20the\x20refund\x20leg\x20routes\x20via\x20the\x20Allocator\x20triggered\x20by\x20the\x20missed-threshold\x20business\x20state\x20at\x20deadline;\x20disputes\x20go\x20to\x20Arbitration']},{'name':'delivery','phase':0x1,'industry':'Restaurant\x20food-delivery\x20/\x20on-demand\x20errand\x20(local\x20fulfillment)','trust_pattern':'Escrow-through-delivery\x20+\x20roster-authorized\x20per-order\x20rider\x20+\x20serial\x20claim\x20window','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'delivery/restaurant-marketplace','key_risk':'Per-order\x20dispatched\x20riders\x20have\x20no\x20on-chain\x20identity\x20—\x20the\x20named-operator\x20roster\x20is\x20their\x20ONLY\x20authorized\x20forward\x20and\x20the\x20roster\x20writer\x20is\x20the\x20de-facto\x20rider\x20admitter\x20(undisclosed,\x20a\x20silent\x20centralization);\x20handover\x20records\x20are\x20unwitnessable\x20by\x20the\x20buyer;\x20rider\x20pay\x20is\x20the\x20platform\x27s\x20off-chain\x20payroll\x20BY\x20DESIGN\x20(T-06\x20correction,\x20sso-tn-261027-7f3a91:\x20a\x20Signer\x20allocator\x20leg\x20CAN\x20pay\x20a\x20per-order\x20rider\x20directly\x20—\x20the\x20on-chain\x20Signer\x20leg\x20bypasses\x20the\x20for_object\x20lock\x20that\x20binds\x20only\x20GuardIdentifier\x20submissions)','build_notes':['Hours-scale\x20windows,\x20not\x20retail\x20DAYS:\x20auto-confirm\x201-2h,\x20claim\x20window\x2024h,\x20settlement\x2024h\x20—\x20food\x20is\x20perishable;\x20anchor\x20every\x20relative\x20gate\x20on\x20progress.history.time\x20(query\x201280,\x20find=last),\x20never\x201272\x20current_time','Dispatch\x20is\x20OFF-CHAIN\x20(K-4):\x20the\x20chain\x20has\x20no\x20dispatch/scheduling\x20primitive\x20—\x20the\x20rider\x27s\x20only\x20chain\x20footprint\x20is\x20the\x20per-order\x20namedOperator\x20roster\x20(permission\x20index\x20221);\x20the\x20roster\x27s\x20write\x20power\x20is\x20the\x20rider-admission\x20power\x20and\x20MUST\x20be\x20disclosed\x20(NAMED_OPERATOR_ROSTER_UNDISCLOSED)','Riders\x20are\x20paid\x20by\x20the\x20platform\x20in\x20this\x20shape\x20(T-06\x20correction,\x20sso-tn-261027-7f3a91):\x20a\x20GuardIdentifier\x20leg\x20pays\x20the\x20order\x27s\x20own\x20CoinWrapper\x20(the\x20on-chain\x20for_object\x20lock),\x20so\x20a\x20slot\x20leg\x20is\x20unfundable\x20for\x20a\x20person\x20—\x20but\x20a\x20Signer\x20leg\x20IS\x20an\x20on-chain\x20payee\x20shape\x20for\x20the\x20rostered\x20rider\x20(the\x20on-chain\x20Signer\x20leg,\x20proven\x20live);\x20the\x20shipped\x20default\x20routes\x20pay\x20through\x20the\x20commission\x20leg\x20as\x20off-chain\x20payroll\x20instead','Serial\x20claim\x20window\x20(TPL-09):\x20settlement\x20departs\x20a\x20mandatory\x20claim_window\x20node\x20so\x20no\x20release\x20can\x20fire\x20while\x20a\x20dispute\x20could\x20still\x20be\x20filed\x20(FACT-ALLOC-03);\x20assert\x20settle_hours\x20>=\x20claim_window_hours\x20at\x20generation','Fee-graded\x20cancellation:\x20a\x20pre-acceptance\x20cancel\x20refunds\x20in\x20full,\x20a\x20post-acceptance\x20kill\x20pays\x20a\x20prep\x20fee\x20—\x20distinct\x20closed_cancel\x20/\x20closed_kill\x20terminals\x20so\x20fee\x20and\x20full\x20refund\x20never\x20share\x20a\x20rail','Transit\x20loss\x20has\x20a\x20buyer\x20rail:\x20an\x20identity-only\x20ReportTransitLoss\x20declaration\x20into\x20the\x20dispute\x20waypoint\x20(no\x20window\x20mid-transit\x20—\x20the\x20anchor\x20row\x20does\x20not\x20exist\x20yet,\x20F-TPL-01\x20trap);\x20the\x20remedy\x20route\x20is\x20arbitration\x20into\x20the\x20full-refund\x20rail,\x20disclosed']},{'name':'group_buy','phase':0x1,'industry':'Community\x20group-buying\x20(leader\x20consolidation\x20+\x20neighborhood\x20pickup)','trust_pattern':'Shared\x20ABSOLUTE\x20batch\x20cutoff\x20+\x20batch\x20consolidation\x20+\x20threshold-gated\x20release\x20(challenger:\x20per-backer\x20unpooled\x20escrow)','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'group_buy/platform-supplied-pickup','key_risk':'The\x20buyer\x20pre-pays\x20against\x20a\x20batch\x20that\x20may\x20never\x20form,\x20and\x20the\x20challenger\x27s\x20supply\x20chain\x20is\x20OFF-CHAIN\x20(undiligence-able\x20before\x20purchase\x20—\x20the\x20trust\x20gap\x20and\x20the\x20main\x20arbitration\x20evidence\x20source);\x20the\x20batch\x20cutoff\x20must\x20be\x20ONE\x20shared\x20absolute\x20timestamp\x20(keeper-written\x20Repository\x20row),\x20never\x20a\x20per-order\x20entry+duration\x20lock;\x20multi-level\x20commission\x20schemes\x20are\x20NOT\x20expressible\x20(single-layer\x20commission\x20only)','build_notes':['The\x20batch\x20cutoff\x20is\x20a\x20SHARED\x20ABSOLUTE\x20timestamp\x20(pattern.time_lock_absolute):\x20one\x20clock\x20for\x20every\x20buyer\x20in\x20the\x20batch,\x20keeper-written\x20per\x20batch\x20into\x20a\x20Repository\x20row\x20—\x20chain\x20Clock\x20is\x20block-driven,\x20so\x20a\x20real-world\x20calendar\x20cutoff\x20(23:00\x20daily)\x20needs\x20pattern.time_source_repository_oracle;\x20a\x20per-order\x20entry+duration\x20lock\x20gives\x20every\x20buyer\x20a\x20DIFFERENT\x20cutoff\x20and\x20is\x20not\x20a\x20batch','Supply-chain\x20suborder\x20commitment\x20(leader):\x20the\x20supplier\x27s\x20sub-service\x20address\x20is\x20a\x20FIXED\x20promise\x20in\x20the\x20ConsolidateBatch\x20guard\x20table\x20(b_submission\x20false,\x20value_type\x20Address)\x20—\x20the\x20whole\x20procurement\x20graph\x20is\x20enumerable\x20and\x20diligence-able\x20BEFORE\x20any\x20buyer\x20pays\x20(the\x20structural\x20trust\x20advantage);\x20the\x20challenger\x20(leader-sourced)\x20has\x20NO\x20such\x20commitment\x20—\x20disclose\x20it\x20as\x20the\x20structural\x20trust\x20gap','Threshold\x20mode\x20reuses\x20the\x20crowdfunding\x20construction\x20wholesale:\x20unpooled\x20per-backer\x20escrow\x20(for_object\x20=\x20the\x20backer\x27s\x20own\x20order),\x20ORDER-keyed\x20contribution\x20rows,\x20the\x20escrow-bound\x20aggregate\x20(per-row\x20min(row,\x20order.amount))\x20and\x20the\x20live-escrow\x20+\x20claimed_by-false\x20legs\x20—\x20the\x20three\x20CROWDFUNDING_*\x20blockers\x20apply\x20automatically','Pickup-point\x20topology:\x20staffed\x20points\x20ride\x20the\x20named-operator\x20leader\x20rail\x20(ShelveAtPoint\x20+\x20HandOverByPoint);\x20AUTOMATED\x20lockers\x20drop\x20both\x20(a\x20locker\x20cannot\x20sign\x20—\x20the\x20buyer\x27s\x20own\x20Collect\x20signature\x20is\x20the\x20stronger\x20handover\x20proof);\x20the\x20unclaimed-goods\x20exit\x20window\x20is\x20mandatory\x20(goods\x20never\x20picked\x20up\x20must\x20refund\x20at\x20a\x20bounded\x20deadline)','Leader\x20commission\x20is\x20a\x20single-layer\x20rate\x20leg\x20paid\x20to\x20the\x20platform\x20Entity\x20with\x20OFF-CHAIN\x20pass-through\x20(a\x20per-order\x20third\x20party\x20has\x20no\x20on-chain\x20payee\x20shape\x20—\x20the\x20for_object\x20lock);\x20multi-level/regional\x20commission\x20is\x20NOT\x20expressible\x20—\x20disclose','Delay\x20compensation\x20pays\x20from\x20the\x20compensation_fund,\x20NEVER\x20from\x20the\x20buyer\x27s\x20escrow\x20(Order\x20binds\x20<=\x201\x20allocator);\x20the\x20fund\x20must\x20be\x20pre-locked\x20to\x203x\x20the\x20largest\x20order\x20(B2)\x20or\x20higher\x20tiers\x20are\x20silently\x20unsellable']},{'name':'general','phase':0x1,'industry':'Anything\x20not\x20covered\x20/\x20hybrid','trust_pattern':'User-defined\x20from\x20scratch','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':null,'key_risk':'No\x20safety\x20net\x20—\x20user\x20must\x20design\x20all\x20trust\x20mechanisms\x20manually','build_notes':['Escape\x20hatch:\x20any\x20user\x20can\x20switch\x20to\x20general\x20mode\x20at\x20any\x20time','Already-created\x20objects\x20under\x20a\x20previous\x20mode\x20remain\x20on-chain\x20(REUSE\x20pattern)','wowok-machine\x20/\x20wowok-guard\x20/\x20wowok-provider\x20become\x20primary\x20references']}];export function matchScenarioMode(a){const b=a['toLowerCase'](),c=inferScenarioTraits(a),e=SCENARIO_MODES['map'](h=>{let i=0x0,j=0x0;for(const k of Object['keys'](c)){j+=0x1;if(h['traits'][k]===c[k])i+=0x1;}if(h['name']!=='general'){const l=MODE_KEYWORDS[h['name']]??[];for(const m of l){if(b['includes'](m))i+=0.5;}}return{'mode':h,'score':i,'total':j};});let f=e[0x0];for(const h of e){if(h['score']>f['score'])f=h;}const g=f['total']>0x0?Math['min'](0x1,f['score']/f['total']):0x0;return{'mode':f['mode'],'confidence':g};}const MODE_KEYWORDS={'freelance':['freelance','design','develop','consult','write','consulting'],'rental':['rent','rental','lease','borrow','equipment','vehicle','property'],'education':['course','training','tutor','teach','education','class'],'travel':['tour','travel','trip','itinerary','vacation'],'subscription':['subscribe','subscription','membership','saas','newsletter','recurring'],'retail':['retail','shop','store','marketplace','sell\x20goods','ecommerce','e-commerce'],'licensing':['license','licensing','royalty','royalties','ip','intellectual\x20property','music\x20rights','sync','beat','franchise','rights'],'crowdfunding':['crowdfunding','crowdfund','fundraising','pledge','backer','kickstarter','campaign','all-or-nothing','threshold\x20goal','presale\x20campaign','raise\x20funds'],'delivery':['delivery','food\x20delivery','takeout','takeaway','errand','on-demand','rider','courier\x20delivery','waimai','last\x20mile'],'group_buy':['group\x20buy','group-buy','groupbuy','community\x20group','team\x20purchase','batch\x20cutoff','neighborhood\x20pickup','pickup\x20point','tuangou']};export function inferScenarioTraits(a){const b=a['toLowerCase']();return{'has_logistics':/ship|delivery|equipment|vehicle|physical|goods/['test'](b),'communication_heavy':/consult|discuss|back-and-forth|custom|bespoke|negotiate/['test'](b),'pure_digital':/digital|file|download|online|software|code|design|content/['test'](b),'long_cycle':/month|long-term|engagement|project|semester|period/['test'](b),'deposit_required':/deposit|escrow|prepay|tuition|reserve/['test'](b),'multi_tier_allocation':/tier|segment|multi-|agency|hotel|guide|driver/['test'](b)};}export const MODE_COMPOSITIONS=[{'modes':['freelance','subscription'],'use_case':'Retainer\x20consulting\x20(monthly\x20+\x20milestone)','conflict_resolution':'Allocator:\x20split\x20into\x20retainer\x20(subscription)\x20+\x20milestone\x20(freelance)'},{'modes':['rental','education'],'use_case':'Equipment\x20training\x20rental','conflict_resolution':'Machine:\x20extend\x20rental\x20nodes\x20with\x20attendance\x20gates'},{'modes':['travel','rental'],'use_case':'Tour\x20with\x20equipment','conflict_resolution':'Allocator:\x20segment\x20allocation\x20+\x20deposit\x20escrow\x20side-by-side'}];export function getScenarioMode(a){return SCENARIO_MODES['find'](b=>b['name']===a);}export function listScenarioModes(){return SCENARIO_MODES;}export function getShippedModes(){return SCENARIO_MODES['filter'](a=>a['phase']===0x1);}export function getModeCompositions(a){return MODE_COMPOSITIONS['filter'](b=>b['modes']['includes'](a));}export const SCENARIO_MODES_VERSION=0xa;
|
|
1
|
+
export const BUYER_ACTION_NODE_RE=/^(reviewed|return_requested|guest_cancelled|withdrawn|charging|cancelled|closed_cancel)$/i;export function unannotatedBuyerActionNodes(a){return a['filter'](b=>!b['operator']&&BUYER_ACTION_NODE_RE['test'](b['name']))['map'](b=>b['name']);}export const SCENARIO_MODES=[{'name':'freelance','phase':0x1,'industry':'Design\x20/\x20dev\x20/\x20consulting\x20/\x20writing','trust_pattern':'Milestone\x20allocation,\x20acceptance\x20gate','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'freelance/enterprise-talent-market','key_risk':'Customer\x20never\x20accepts\x20delivery\x20—\x20provider\x20cannot\x20get\x20paid','build_notes':['Use\x20Service\x20`setting_lock_duration`\x20to\x20lock\x20rules\x20for\x20the\x20engagement\x20duration','WIP\x20hash\x20on\x20every\x20milestone\x20deliverable\x20is\x20mandatory\x20—\x20protects\x20provider\x20in\x20disputes','Acceptance\x20gate\x20is\x20the\x20trust\x20pivot\x20—\x20both\x20parties\x20must\x20agree\x20on\x20criteria\x20per\x20milestone','Milestones\x20map\x20to\x20deliverable-Guarded\x20forwards;\x20each\x20accepted\x20milestone\x20releases\x20its\x20escrowed\x20slice\x20(allocation.distribute_milestone)','Scope\x20changes\x20are\x20recorded\x20as\x20WTS\x20change-requests\x20at\x20kickoff/throughout\x20—\x20never\x20silent','R-M1-11:\x20no\x20\x27refunded\x27/\x27disputed\x27/\x27arb\x27/\x27cancelled\x27\x20nodes\x20—\x20refunds\x20route\x20via\x20Allocator\x20(to\x20OrderHolder)\x20triggered\x20by\x20\x27closed_cancel\x27,\x20disputes\x20via\x20Arbitration','Payment\x20exception\x20compensation\x20for\x20delivery\x20delays\x20—\x20provider\x20Treasury\x20auto-compensates\x20customer\x20(§2.13)','Project-Catalog\x20orders\x20have\x20NO\x20milestones\x20(single\x20funded\x20order\x20+\x20steps\x20timeline);\x20milestones\x20here\x20model\x20fixed-price\x20CONTRACTS.\x20For\x20catalog-style\x20listings\x20(tiered\x20pricing\x20+\x20add-ons\x20+\x20buyer\x20requirements)\x20use\x20the\x20freelance/catalog-tiers\x20template\x20instead','Time-bound\x20catalog\x20rules\x20(24h\x20instant\x20cancel,\x2048h\x20requirements\x20timeout,\x2014-day\x20auto-accept)\x20need\x20a\x20time\x20Guard\x20PLUS\x20an\x20off-chain\x20keeper\x20per\x20window\x20-\x20Guards\x20take\x20an\x20immutable\x20duration\x20constant']},{'name':'rental','phase':0x1,'industry':'Equipment\x20/\x20vehicle\x20/\x20property\x20rental','trust_pattern':'Deposit\x20escrow,\x20return\x20inspection','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':!![],'multi_tier_allocation':![]},'default_template':'rental/institutional-longstay','key_risk':'Owner\x20claims\x20damage\x20without\x20pre-rental\x20WIP\x20—\x20customer\x20loses\x20deposit\x20unfairly','build_notes':['Pre-rental\x20WIP\x20is\x20non-negotiable\x20—\x20without\x20it,\x20damage\x20claims\x20fail','Deposit\x20must\x20be\x20escrowed,\x20not\x20direct-transferred\x20—\x20enables\x20fair\x20deduction','Inspection\x20gate\x20prevents\x20customer\x20from\x20denying\x20damage','Overdue\x20handling\x20uses\x20a\x20time-lock\x20Guard\x20(clock)\x20—\x20the\x20Guard\x20only\x20ALLOWS\x20the\x20overdue\x20transition;\x20automatic\x20advancement\x20needs\x20an\x20off-chain\x20keeper\x20(see\x20DESIGN-REVIEW\x20C-3)','Extensions\x20are\x20modeled\x20as\x20separate\x20sub-orders\x20(REUSE\x20pattern),\x20not\x20as\x20machine\x20cycles\x20—\x20an\x20in-order\x20loop\x20replays\x20its\x20forwards\x27\x20fund\x20rails\x20every\x20lap','R-M1-11:\x20no\x20\x27deposit_refunded\x27/\x27deposit_deducted\x27/\x27refunded\x27\x20nodes\x20—\x20deposit\x20refund/deduction\x20flows\x20through\x20Allocator\x20triggered\x20by\x20return_approved/damage_confirmed\x20business\x20states','Payment\x20exception\x20compensation\x20for\x20return\x20delays\x20—\x20Treasury\x20withdraws\x20scene-bound\x20Payment\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/usage\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'education','phase':0x2,'industry':'Courses\x20/\x20training\x20/\x20tutoring','trust_pattern':'Periodic\x20release\x20per\x20session,\x20attendance\x20Guard','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':![]},'default_template':'education/live-class-cohort','key_risk':'Tutoring\x20institutions\x20run\x20away\x20with\x20prepaid\x20tuition','build_notes':['Use\x20Service\x20`setting_lock_duration`\x20to\x20lock\x20rules\x20for\x20the\x20entire\x20term\x20(regulatory\x20compliance,\x20>=90d)','Attendance\x20Guard\x20needs\x20WIP\x20hash\x20for\x20session\x20content\x20commitment;\x20attendance\x20evidence\x20lives\x20in\x20the\x20class\x20Repository','Per-session\x20release\x20requires\x20threshold-based\x20trigger\x20—\x20each\x20attended\x20session\x20releases\x201/N','session_1..session_3\x20are\x20representative\x20—\x20configure\x20the\x20real\x20session\x20count\x20(session_N)\x20at\x20build\x20time;\x20each\x20session\x20=\x20one\x20attendance-Guarded\x20forward','Pause/deferral\x20is\x20a\x20terminal\x20node\x20+\x20new\x20sub-order\x20(REUSE\x20pattern)\x20—\x20never\x20a\x20loop\x20back\x20into\x20the\x20session\x20chain\x20(a\x20loop\x20replays\x20the\x20session\x20forwards\x27\x20fund\x20rails\x20every\x20lap;\x20if\x20a\x20loop\x20is\x20unavoidable\x20it\x20must\x20keep\x20a\x20cycle-breaking\x20exit)','Supply\x20chain\x20sub-orders\x20for\x20course\x20module\x20progressive\x20unlock\x20—\x20each\x20module\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20previous\x20module\x20completion\x20(§2.12)','Repository\x20for\x20learning\x20progress\x20collaboration\x20data\x20—\x20progress\x20as\x20key,\x20session\x20data\x20as\x20value\x20(§2.10)']},{'name':'travel','phase':0x2,'industry':'Custom\x20tours\x20/\x20multi-segment\x20trips','trust_pattern':'Multi-tier\x20allocation\x20per\x20segment','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'travel/destination-experience','key_risk':'Paid\x20in\x20full\x20then\x20service\x20shrinks\x20—\x20multi-tier\x20transparency\x20prevents\x20this','build_notes':['Multi-tier\x20Allocation\x20is\x20WoWok\x27s\x20unique\x20advantage\x20over\x20traditional\x20travel\x20platforms','segment_guard\x20needs\x20standardized\x20WIP\x20templates\x20per\x20segment\x20type\x20(hotel,\x20transport,\x20activity)','Multi-tier\x20waterfall\x20needs\x20guard\x20chaining\x20validation','Weather/force-majeure\x20branches\x20enter\x20reschedule\x20(terminal)\x20or\x20partial-refund\x20interrupted\x20terminal\x20—\x20never\x20loop\x20back\x20into\x20the\x20segment\x20chain\x20(a\x20loop\x20replays\x20the\x20segment\x20forwards\x27\x20fund\x20rails\x20every\x20lap;\x20if\x20a\x20loop\x20is\x20unavoidable\x20it\x20must\x20keep\x20a\x20cycle-breaking\x20exit)','Supplier\x20sub-orders\x20each\x20carry\x20their\x20own\x20machine\x20—\x20hotel/guide/driver\x20fulfill\x20independently\x20(§2.12)','Supply\x20chain\x20sub-orders\x20—\x20each\x20tour\x20segment\x20=\x20sub-service\x20with\x20buy_guard\x20verifying\x20main\x20tour\x20order\x20(§2.12)','Payment\x20exception\x20compensation\x20for\x20flight/segment\x20delays\x20(§2.13)','Repository\x20quote_guard\x20for\x20weather/travel\x20data\x20subscription\x20revenue\x20(§2.11)']},{'name':'subscription','phase':0x3,'industry':'SaaS\x20/\x20content\x20membership\x20/\x20periodic\x20service','trust_pattern':'Periodic\x20charge,\x20cancel\x20Guard','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'subscription/creator-membership','key_risk':'Auto-renew\x20trap\x20and\x20platform-takes-30%\x20—\x20WoWok\x20native\x20solution','build_notes':['Pure\x20digital\x20—\x20native\x20WoWok\x20soil','charge_guard\x20needs\x20periodic\x20trigger\x20(off-chain\x20scheduler\x20+\x20on-chain\x20Guard)','Renewal\x20is\x20an\x20explicit\x20buyer-side\x20forward\x20(or\x20a\x20Guard-gated\x20auto-renew\x20WITH\x20WTS\x20notice)\x20—\x20never\x20silent','Cancellation\x20is\x20frictionless\x20and\x20next-period\x20effective;\x20pro-rata\x20refund\x20for\x20unearned\x20periods','Forbid\x20dead-end\x20nodes\x20(prevent\x20lock-in);\x20every\x20state\x20must\x20have\x20a\x20forward\x20or\x20be\x20an\x20intended\x20terminal','Targets\x20indie\x20creators,\x20niche\x20SaaS,\x20paid\x20newsletters','Repository\x20quote_guard\x20for\x20creator\x20data\x20subscription\x20revenue\x20—\x20creators\x20publish\x20paid\x20data,\x20users\x20pay\x20to\x20access\x20(§2.11)']},{'name':'retail','phase':0x1,'industry':'Goods\x20retail\x20/\x20marketplace\x20/\x20e-commerce','trust_pattern':'Escrow\x20+\x20confirm-on-receipt\x20release','traits':{'has_logistics':!![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'retail/scale-marketplace','key_risk':'Products\x20don\x27t\x20match\x20description\x20—\x20no\x20refund\x20path\x20for\x20returns','build_notes':['Logistics\x20WIP\x20(tracking\x20number)\x20is\x20essential\x20—\x20shipping\x20evidence\x20protects\x20both\x20parties\x20in\x20return\x20disputes','Confirm\x20gate\x20prevents\x20merchant\x20from\x20self-confirming\x20receipt','Refund\x20path\x20must\x20support\x20return-and-exchange\x20flow;\x20refund_window\x20>=\x207d','Return\x20request\x20is\x20time-lock\x20gated\x20—\x20after\x20the\x20window\x20closes,\x20returns\x20need\x20merchant\x20permission\x20or\x20arbitration','Compensation\x20fund\x20covers\x20return/exchange\x20disputes','R-M1-11:\x20no\x20\x27refunded\x27\x20node\x20—\x20refunds\x20route\x20via\x20Allocator\x20triggered\x20by\x20returned/cancelled\x20business\x20states;\x20disputes\x20go\x20to\x20Arbitration']},{'name':'licensing','phase':0x1,'industry':'IP\x20/\x20royalty\x20licensing\x20/\x20metered\x20asset\x20licenses','trust_pattern':'Terms\x20hash-anchored,\x20on-chain\x20royalty\x20split,\x20territory/term\x20Guard','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':!![],'long_cycle':!![],'deposit_required':![],'multi_tier_allocation':!![]},'default_template':'licensing/royalty-stream-auction','key_risk':'Buyer\x20trusts\x20the\x20seller\x27s\x20royalty/usage\x20reporting\x20—\x20without\x20an\x20on-chain\x20meter\x20the\x20accounting\x20honesty\x20is\x20only\x20as\x20good\x20as\x20the\x20attestation\x20and\x20the\x20compensation\x20backstop','build_notes':['Anchor\x20the\x20license\x20terms\x20(territory,\x20term,\x20media,\x20caps,\x20exclusivity)\x20as\x20a\x20WIP\x20hash\x20—\x20the\x20granted\x20rights\x20must\x20be\x20provable\x20in\x20a\x20dispute,\x20not\x20prose','Royalty\x20/\x20purchase-proceeds\x20split\x20is\x20an\x20Allocation\x20Rate\x20plan\x20(bps\x20summing\x20to\x2010000\x20across\x20rights-holders\x20+\x20platform);\x20the\x20split\x20is\x20frozen\x20at\x20publish\x20and\x20auditable\x20by\x20every\x20recipient','Recurring\x20royalty:\x20the\x20Allocation\x20pool\x20is\x20re-fillable\x20(order_renew\x20top-ups)\x20and\x20a\x20guard-keyed\x20periodic\x20alloc\x20with\x20a\x20period-N\x20once-key\x20(identifier\x20255)\x20releases\x20each\x20period\x20—\x20payroll-style\x20repeat\x20runs\x20stay\x20possible\x20without\x20the\x20once-slot','Territory\x20is\x20enforced\x20by\x20a\x20Service\x20buy_guard\x20running\x20pattern.identity_check_allowlist\x20(allowlist\x20as\x20an\x20Address-vector\x20table\x20constant);\x20term\x20/\x20inspection\x20window\x20is\x20a\x20tpl_time_lock_progress\x20forward\x20guard\x20(Clock\x20>=\x20entry_time\x20+\x20duration)','Time-lock\x20duration\x20is\x20an\x20IMMUTABLE\x20table\x20constant\x20fixed\x20at\x20publish\x20—\x20an\x20expired\x20window\x20only\x20BLOCKS\x20the\x20forward,\x20it\x20never\x20auto-refunds;\x20automatic\x20advancement\x20on\x20timeout\x20needs\x20an\x20off-chain\x20keeper','🔴\x20AUCTION\x20GAP:\x20there\x20is\x20NO\x20on-chain\x20ascending-auction\x20/\x20bid-ledger\x20/\x20highest-bidder\x20primitive.\x20Model\x20a\x20competitive\x20sale\x20as:\x20winner\x20resolved\x20OFF-CHAIN\x20(prose),\x20then\x20the\x20winner\x20calls\x20buy\x20like\x20any\x20buyer\x20—\x20optionally\x20gate\x20buy\x20with\x20an\x20allowlist\x20guard\x20carrying\x20the\x20attested\x20winner\x20address.\x20Never\x20claim\x20the\x20chain\x20runs\x20the\x20auction','🔴\x20METERED-CAPS\x20GAP:\x20there\x20is\x20NO\x20usage\x20oracle/meter.\x20A\x20\x27limited\x20to\x20N\x20streams/sales\x27\x20cap\x20can\x20only\x20be\x20an\x20ATTESTED\x20Repository\x20counter\x20that\x20a\x20forward\x20guard\x20reads\x20via\x20the\x20repository.data\x20count-where\x20query\x20—\x20the\x20count\x20is\x20only\x20as\x20trustworthy\x20as\x20its\x20write-guard\x20(self/attested),\x20never\x20an\x20oracle\x20feed.\x20Disclose\x20this\x20honestly;\x20never\x20present\x20a\x20cap\x20as\x20chain-enforced\x20metering','R-M1-11:\x20no\x20\x27refunded\x27/\x27cancelled\x27\x20fund\x20terminals\x20—\x20refunds\x20route\x20via\x20the\x20Allocator\x20triggered\x20by\x20a\x20business\x20state\x20(e.g.\x20inspection_failed);\x20disputes\x20go\x20to\x20Arbitration']},{'name':'crowdfunding','phase':0x1,'industry':'All-or-nothing\x20threshold\x20campaigns\x20/\x20flexible\x20keep-it-all\x20fundraising','trust_pattern':'Per-contributor\x20escrow\x20(unpooled)\x20+\x20on-chain\x20aggregate\x20threshold\x20+\x20deadline\x20two-leg\x20release/refund','traits':{'has_logistics':![],'communication_heavy':!![],'pure_digital':!![],'long_cycle':!![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'crowdfunding/all-or-nothing-threshold','key_risk':'The\x20funding\x20threshold\x20is\x20an\x20aggregate\x20read\x20over\x20a\x20shared\x20campaign\x20ledger\x20—\x20each\x20contribution\x20row\x20is\x20writer-bound\x20to\x20its\x20funder,\x20but\x20the\x20aggregate\x20is\x20a\x20read-only\x20sum\x20of\x20declared\x20rows,\x20not\x20an\x20independent\x20re-computation\x20of\x20every\x20escrow;\x20roster\x20completeness\x20is\x20keeper-attested.\x20Funders\x20also\x20trust\x20eventual\x20project\x20delivery,\x20backed\x20only\x20by\x20compensation_fund\x20+\x20arbitration','build_notes':['Per-contributor\x20escrow,\x20NEVER\x20pooled:\x20each\x20funder\x27s\x20Order\x20holds\x20its\x20OWN\x20Allocation\x20with\x20payment_info.for_object\x20bound\x20to\x20that\x20Order\x20—\x20because\x20the\x20money\x20is\x20never\x20balance::join-ed\x20into\x20one\x20pot,\x20attribution\x20survives\x20and\x20each\x20contribution\x20is\x20refundable\x20to\x20its\x20own\x20funder','Threshold\x20gate\x20=\x20an\x20on-chain\x20aggregate:\x20a\x20shared\x20campaign\x20Repository\x20holds\x20one\x20numeric\x20row\x20per\x20contribution\x20(keyed\x20by\x20the\x20contribution,\x20tagged\x20with\x20a\x20campaign\x20id);\x20the\x20settlement\x20Guard\x20reads\x20it\x20back\x20with\x20the\x20repository.data\x20sum-where\x20query\x20(1174\x20→\x20U256,\x20overflow-safe)\x20and\x20compares\x20against\x20the\x20threshold\x20constant','Write-side\x20binding\x20is\x20MANDATORY:\x20contribution\x20rows\x20are\x20written\x20under\x20pattern.repository_write_authorization\x20with\x20an\x20identity\x20leaf\x20(order.owner\x20==\x20Signer\x20/\x20order.agent\x20has\x20Signer)\x20so\x20a\x20funder\x20can\x20only\x20record\x20their\x20OWN\x20contribution\x20—\x20existence-is-not-trust\x20(R-X1-17),\x20an\x20unbound\x20write_guard\x20makes\x20the\x20aggregate\x20forgeable','Deadline\x20=\x20a\x20time-lock:\x20both\x20settlement\x20legs\x20require\x20Clock\x20>=\x20deadline\x20via\x20pattern.time_lock_progress\x20(query\x201280,\x20node-ENTRY\x20anchored);\x20BEFORE\x20the\x20deadline\x20a\x20funder\x20may\x20withdraw\x20(buyer-self-service\x20withdrawn\x20rail:\x20removes\x20their\x20writer-bound\x20row\x20+\x20full\x20refund\x20—\x20A12\x20fix,\x20was\x20wrongly\x20\x27no\x20early\x20withdrawal\x27);\x20AFTER\x20the\x20deadline\x20funds\x20are\x20committed\x20to\x20the\x20threshold\x20outcome','Two-leg\x20escrow\x20exit\x20(D-BUG-2\x20polarity):\x20release\x20leg\x20(→\x20project\x20Entity)\x20gated\x20logic_and[sum_where\x20>=\x20threshold,\x20clock\x20>=\x20deadline];\x20refund\x20leg\x20(→\x20for_object,\x20the\x20funder\x27s\x20own\x20Order)\x20gated\x20logic_and[sum_where\x20<\x20threshold,\x20clock\x20>=\x20deadline]\x20—\x20mutually\x20exclusive\x20on\x20the\x20aggregate\x20comparison,\x20so\x20exactly\x20one\x20is\x20satisfiable\x20once\x20the\x20deadline\x20passes','Keeper\x20batch\x20settlement:\x20on\x20a\x20missed\x20campaign\x20a\x20keeper\x20enumerates\x20every\x20contributor\x20via\x20repository.data\x20find-where\x20(1176\x20→\x20VectorAddress)\x20/\x20keys-where\x20(1177\x20→\x20VectorString)\x20and\x20advances\x20each\x20funder\x27s\x20refund\x20leg\x20in\x20one\x20PTB\x20(or\x20N\x20PTBs)\x20—\x20an\x20ops\x20efficiency,\x20not\x20a\x20chain\x20capability','🔴\x20AGGREGATE\x20TRUST\x20BOUNDARY:\x20the\x20sum\x20is\x20only\x20as\x20honest\x20as\x20the\x20writer-bound\x20rows;\x20it\x20is\x20NOT\x20independently\x20re-derivable\x20on-chain\x20without\x20reading\x20every\x20escrow\x20balance.\x20Disclose\x20this\x20honestly\x20(L-04);\x20never\x20present\x20the\x20threshold\x20as\x20a\x20chain-verified\x20total-custody\x20proof','🔴\x20L-01\x20NON-INVESTMENT:\x20crowdfunding\x20copy\x20must\x20never\x20promise\x20investment\x20returns,\x20yield,\x20or\x20token-price\x20appreciation\x20—\x20it\x20is\x20a\x20threshold\x20purchase/preorder/donation,\x20not\x20a\x20security','🔴\x20L-05\x20KYC/AML:\x20pooled\x20fundraising\x20is\x20high\x20regulatory\x20intensity\x20—\x20cross-border\x20funds\x20and\x20reward\x20tiers\x20may\x20trigger\x20securities/money-transmission\x20rules;\x20flag\x20for\x20compliance,\x20do\x20not\x20automate\x20around\x20them','R-M1-11:\x20no\x20\x27refunded\x27/\x27cancelled\x27\x20fund\x20terminals\x20—\x20the\x20refund\x20leg\x20routes\x20via\x20the\x20Allocator\x20triggered\x20by\x20the\x20missed-threshold\x20business\x20state\x20at\x20deadline;\x20disputes\x20go\x20to\x20Arbitration']},{'name':'delivery','phase':0x1,'industry':'Restaurant\x20food-delivery\x20/\x20on-demand\x20errand\x20(local\x20fulfillment)','trust_pattern':'Escrow-through-delivery\x20+\x20roster-authorized\x20per-order\x20rider\x20+\x20serial\x20claim\x20window','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':'delivery/restaurant-marketplace','key_risk':'Per-order\x20dispatched\x20riders\x20have\x20no\x20on-chain\x20identity\x20—\x20the\x20named-operator\x20roster\x20is\x20their\x20ONLY\x20authorized\x20forward\x20and\x20the\x20roster\x20writer\x20is\x20the\x20de-facto\x20rider\x20admitter\x20(undisclosed,\x20a\x20silent\x20centralization);\x20handover\x20records\x20are\x20unwitnessable\x20by\x20the\x20buyer;\x20rider\x20pay\x20is\x20the\x20platform\x27s\x20off-chain\x20payroll\x20BY\x20DESIGN\x20(T-06\x20correction,\x20sso-tn-261027-7f3a91:\x20a\x20Signer\x20allocator\x20leg\x20CAN\x20pay\x20a\x20per-order\x20rider\x20directly\x20—\x20the\x20on-chain\x20Signer\x20leg\x20bypasses\x20the\x20for_object\x20lock\x20that\x20binds\x20only\x20GuardIdentifier\x20submissions)','build_notes':['Hours-scale\x20windows,\x20not\x20retail\x20DAYS:\x20auto-confirm\x201-2h,\x20claim\x20window\x2024h,\x20settlement\x2024h\x20—\x20food\x20is\x20perishable;\x20anchor\x20every\x20relative\x20gate\x20on\x20progress.history.time\x20(query\x201280,\x20find=last),\x20never\x201272\x20current_time','Dispatch\x20is\x20OFF-CHAIN\x20(K-4):\x20the\x20chain\x20has\x20no\x20dispatch/scheduling\x20primitive\x20—\x20the\x20rider\x27s\x20only\x20chain\x20footprint\x20is\x20the\x20per-order\x20namedOperator\x20roster\x20(permission\x20index\x20221);\x20the\x20roster\x27s\x20write\x20power\x20is\x20the\x20rider-admission\x20power\x20and\x20MUST\x20be\x20disclosed\x20(NAMED_OPERATOR_ROSTER_UNDISCLOSED)','Riders\x20are\x20paid\x20by\x20the\x20platform\x20in\x20this\x20shape\x20(T-06\x20correction,\x20sso-tn-261027-7f3a91):\x20a\x20GuardIdentifier\x20leg\x20pays\x20the\x20order\x27s\x20own\x20CoinWrapper\x20(the\x20on-chain\x20for_object\x20lock),\x20so\x20a\x20slot\x20leg\x20is\x20unfundable\x20for\x20a\x20person\x20—\x20but\x20a\x20Signer\x20leg\x20IS\x20an\x20on-chain\x20payee\x20shape\x20for\x20the\x20rostered\x20rider\x20(the\x20on-chain\x20Signer\x20leg,\x20proven\x20live);\x20the\x20shipped\x20default\x20routes\x20pay\x20through\x20the\x20commission\x20leg\x20as\x20off-chain\x20payroll\x20instead','Serial\x20claim\x20window\x20(TPL-09):\x20settlement\x20departs\x20a\x20mandatory\x20claim_window\x20node\x20so\x20no\x20release\x20can\x20fire\x20while\x20a\x20dispute\x20could\x20still\x20be\x20filed\x20(FACT-ALLOC-03);\x20assert\x20settle_hours\x20>=\x20claim_window_hours\x20at\x20generation','Fee-graded\x20cancellation:\x20a\x20pre-acceptance\x20cancel\x20refunds\x20in\x20full,\x20a\x20post-acceptance\x20kill\x20pays\x20a\x20prep\x20fee\x20—\x20distinct\x20closed_cancel\x20/\x20closed_kill\x20terminals\x20so\x20fee\x20and\x20full\x20refund\x20never\x20share\x20a\x20rail','Transit\x20loss\x20has\x20a\x20buyer\x20rail:\x20an\x20identity-only\x20ReportTransitLoss\x20declaration\x20into\x20the\x20dispute\x20waypoint\x20(no\x20window\x20mid-transit\x20—\x20the\x20anchor\x20row\x20does\x20not\x20exist\x20yet,\x20F-TPL-01\x20trap);\x20the\x20remedy\x20route\x20is\x20arbitration\x20into\x20the\x20full-refund\x20rail,\x20disclosed']},{'name':'group_buy','phase':0x1,'industry':'Community\x20group-buying\x20(leader\x20consolidation\x20+\x20neighborhood\x20pickup)','trust_pattern':'Shared\x20ABSOLUTE\x20batch\x20cutoff\x20+\x20batch\x20consolidation\x20+\x20threshold-gated\x20release\x20(challenger:\x20per-backer\x20unpooled\x20escrow)','traits':{'has_logistics':!![],'communication_heavy':!![],'pure_digital':![],'long_cycle':![],'deposit_required':!![],'multi_tier_allocation':!![]},'default_template':'group_buy/platform-supplied-pickup','key_risk':'The\x20buyer\x20pre-pays\x20against\x20a\x20batch\x20that\x20may\x20never\x20form,\x20and\x20the\x20challenger\x27s\x20supply\x20chain\x20is\x20OFF-CHAIN\x20(undiligence-able\x20before\x20purchase\x20—\x20the\x20trust\x20gap\x20and\x20the\x20main\x20arbitration\x20evidence\x20source);\x20the\x20batch\x20cutoff\x20must\x20be\x20ONE\x20shared\x20absolute\x20timestamp\x20(keeper-written\x20Repository\x20row),\x20never\x20a\x20per-order\x20entry+duration\x20lock;\x20multi-level\x20commission\x20schemes\x20are\x20NOT\x20expressible\x20(single-layer\x20commission\x20only)','build_notes':['The\x20batch\x20cutoff\x20is\x20a\x20SHARED\x20ABSOLUTE\x20timestamp\x20(pattern.time_lock_absolute):\x20one\x20clock\x20for\x20every\x20buyer\x20in\x20the\x20batch,\x20keeper-written\x20per\x20batch\x20into\x20a\x20Repository\x20row\x20—\x20chain\x20Clock\x20is\x20block-driven,\x20so\x20a\x20real-world\x20calendar\x20cutoff\x20(23:00\x20daily)\x20needs\x20pattern.time_source_repository_oracle;\x20a\x20per-order\x20entry+duration\x20lock\x20gives\x20every\x20buyer\x20a\x20DIFFERENT\x20cutoff\x20and\x20is\x20not\x20a\x20batch','Supply-chain\x20suborder\x20commitment\x20(leader):\x20the\x20supplier\x27s\x20sub-service\x20address\x20is\x20a\x20FIXED\x20promise\x20in\x20the\x20ConsolidateBatch\x20guard\x20table\x20(b_submission\x20false,\x20value_type\x20Address)\x20—\x20the\x20whole\x20procurement\x20graph\x20is\x20enumerable\x20and\x20diligence-able\x20BEFORE\x20any\x20buyer\x20pays\x20(the\x20structural\x20trust\x20advantage);\x20the\x20challenger\x20(leader-sourced)\x20has\x20NO\x20such\x20commitment\x20—\x20disclose\x20it\x20as\x20the\x20structural\x20trust\x20gap','Threshold\x20mode\x20reuses\x20the\x20crowdfunding\x20construction\x20wholesale:\x20unpooled\x20per-backer\x20escrow\x20(for_object\x20=\x20the\x20backer\x27s\x20own\x20order),\x20ORDER-keyed\x20contribution\x20rows,\x20the\x20escrow-bound\x20aggregate\x20(per-row\x20min(row,\x20order.amount,\x20live\x20allocation.balance\x20—\x20v140\x20live\x20cap))\x20and\x20the\x20live-escrow\x20+\x20claimed_by-false\x20legs\x20—\x20the\x20three\x20CROWDFUNDING_*\x20blockers\x20apply\x20automatically','Pickup-point\x20topology:\x20staffed\x20points\x20ride\x20the\x20named-operator\x20leader\x20rail\x20(ShelveAtPoint\x20+\x20HandOverByPoint);\x20AUTOMATED\x20lockers\x20drop\x20both\x20(a\x20locker\x20cannot\x20sign\x20—\x20the\x20buyer\x27s\x20own\x20Collect\x20signature\x20is\x20the\x20stronger\x20handover\x20proof);\x20the\x20unclaimed-goods\x20exit\x20window\x20is\x20mandatory\x20(goods\x20never\x20picked\x20up\x20must\x20refund\x20at\x20a\x20bounded\x20deadline)','Leader\x20commission\x20is\x20a\x20single-layer\x20rate\x20leg\x20paid\x20to\x20the\x20platform\x20Entity\x20with\x20OFF-CHAIN\x20pass-through\x20(a\x20per-order\x20third\x20party\x20has\x20no\x20on-chain\x20payee\x20shape\x20—\x20the\x20for_object\x20lock);\x20multi-level/regional\x20commission\x20is\x20NOT\x20expressible\x20—\x20disclose','Delay\x20compensation\x20pays\x20from\x20the\x20compensation_fund,\x20NEVER\x20from\x20the\x20buyer\x27s\x20escrow\x20(Order\x20binds\x20<=\x201\x20allocator);\x20the\x20fund\x20must\x20be\x20pre-locked\x20to\x203x\x20the\x20largest\x20order\x20(B2)\x20or\x20higher\x20tiers\x20are\x20silently\x20unsellable']},{'name':'general','phase':0x1,'industry':'Anything\x20not\x20covered\x20/\x20hybrid','trust_pattern':'User-defined\x20from\x20scratch','traits':{'has_logistics':![],'communication_heavy':![],'pure_digital':![],'long_cycle':![],'deposit_required':![],'multi_tier_allocation':![]},'default_template':null,'key_risk':'No\x20safety\x20net\x20—\x20user\x20must\x20design\x20all\x20trust\x20mechanisms\x20manually','build_notes':['Escape\x20hatch:\x20any\x20user\x20can\x20switch\x20to\x20general\x20mode\x20at\x20any\x20time','Already-created\x20objects\x20under\x20a\x20previous\x20mode\x20remain\x20on-chain\x20(REUSE\x20pattern)','wowok-machine\x20/\x20wowok-guard\x20/\x20wowok-provider\x20become\x20primary\x20references']}];export function matchScenarioMode(a){const b=a['toLowerCase'](),c=inferScenarioTraits(a),e=SCENARIO_MODES['map'](h=>{let i=0x0,j=0x0;for(const k of Object['keys'](c)){j+=0x1;if(h['traits'][k]===c[k])i+=0x1;}if(h['name']!=='general'){const l=MODE_KEYWORDS[h['name']]??[];for(const m of l){if(b['includes'](m))i+=0.5;}}return{'mode':h,'score':i,'total':j};});let f=e[0x0];for(const h of e){if(h['score']>f['score'])f=h;}const g=f['total']>0x0?Math['min'](0x1,f['score']/f['total']):0x0;return{'mode':f['mode'],'confidence':g};}const MODE_KEYWORDS={'freelance':['freelance','design','develop','consult','write','consulting'],'rental':['rent','rental','lease','borrow','equipment','vehicle','property'],'education':['course','training','tutor','teach','education','class'],'travel':['tour','travel','trip','itinerary','vacation'],'subscription':['subscribe','subscription','membership','saas','newsletter','recurring'],'retail':['retail','shop','store','marketplace','sell\x20goods','ecommerce','e-commerce'],'licensing':['license','licensing','royalty','royalties','ip','intellectual\x20property','music\x20rights','sync','beat','franchise','rights'],'crowdfunding':['crowdfunding','crowdfund','fundraising','pledge','backer','kickstarter','campaign','all-or-nothing','threshold\x20goal','presale\x20campaign','raise\x20funds'],'delivery':['delivery','food\x20delivery','takeout','takeaway','errand','on-demand','rider','courier\x20delivery','waimai','last\x20mile'],'group_buy':['group\x20buy','group-buy','groupbuy','community\x20group','team\x20purchase','batch\x20cutoff','neighborhood\x20pickup','pickup\x20point','tuangou']};export function inferScenarioTraits(a){const b=a['toLowerCase']();return{'has_logistics':/ship|delivery|equipment|vehicle|physical|goods/['test'](b),'communication_heavy':/consult|discuss|back-and-forth|custom|bespoke|negotiate/['test'](b),'pure_digital':/digital|file|download|online|software|code|design|content/['test'](b),'long_cycle':/month|long-term|engagement|project|semester|period/['test'](b),'deposit_required':/deposit|escrow|prepay|tuition|reserve/['test'](b),'multi_tier_allocation':/tier|segment|multi-|agency|hotel|guide|driver/['test'](b)};}export const MODE_COMPOSITIONS=[{'modes':['freelance','subscription'],'use_case':'Retainer\x20consulting\x20(monthly\x20+\x20milestone)','conflict_resolution':'Allocator:\x20split\x20into\x20retainer\x20(subscription)\x20+\x20milestone\x20(freelance)'},{'modes':['rental','education'],'use_case':'Equipment\x20training\x20rental','conflict_resolution':'Machine:\x20extend\x20rental\x20nodes\x20with\x20attendance\x20gates'},{'modes':['travel','rental'],'use_case':'Tour\x20with\x20equipment','conflict_resolution':'Allocator:\x20segment\x20allocation\x20+\x20deposit\x20escrow\x20side-by-side'}];export function getScenarioMode(a){return SCENARIO_MODES['find'](b=>b['name']===a);}export function listScenarioModes(){return SCENARIO_MODES;}export function getShippedModes(){return SCENARIO_MODES['filter'](a=>a['phase']===0x1);}export function getModeCompositions(a){return MODE_COMPOSITIONS['filter'](b=>b['modes']['includes'](a));}export const SCENARIO_MODES_VERSION=0xa;
|
|
@@ -6,6 +6,10 @@ export declare const SEMANTIC_IR_ACCEPTED_INPUT_VERSIONS: readonly [1, 2];
|
|
|
6
6
|
export declare const TRAIT_KEYS: Array<keyof IndustryTraits>;
|
|
7
7
|
export declare const SEMANTIC_CLAIM_KEYS: readonly ["reward_pool_amount", "funding_threshold_amount", "min_order_price_amount"];
|
|
8
8
|
export type SemanticClaimKey = (typeof SEMANTIC_CLAIM_KEYS)[number];
|
|
9
|
+
export declare function resolveClaimKey(raw: string): {
|
|
10
|
+
key: SemanticClaimKey;
|
|
11
|
+
note?: string;
|
|
12
|
+
} | undefined;
|
|
9
13
|
export declare const SemanticIRInputSchema: z.ZodObject<{
|
|
10
14
|
schema_version: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
|
|
11
15
|
locale: z.ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createHash}from'node:crypto';import{z}from'zod';import{DISCOVERY_PRODUCT_REFS,DISCOVERY_TAG_VOCABULARY,isDiscoveryTag}from'./builtin-templates.js';import{BOOLEAN_TRAIT_KEYS,DOMAIN_PRIORS,ENUM_TRAIT_SCALES,EVIDENCE_THRESHOLD}from'./industry-generalizer.js';import{isRegisteredIndustry,resolveIndustryName}from'./industry-registry.js';export const SEMANTIC_IR_SCHEMA_VERSION=0x2;export const SEMANTIC_IR_ACCEPTED_INPUT_VERSIONS=[0x1,0x2];export const TRAIT_KEYS=[...BOOLEAN_TRAIT_KEYS,...Object['keys'](ENUM_TRAIT_SCALES)];export const SEMANTIC_CLAIM_KEYS=['reward_pool_amount','funding_threshold_amount','min_order_price_amount'];const SpanSchema=z['object']({'start':z['number']()['int']()['nonnegative'](),'end':z['number']()['int']()['nonnegative']()})['strict'](),TraitEvidenceSchema=z['object']({'trait':z['string']()['max'](0x40),'value':z['union']([z['boolean'](),z['string']()['max'](0x20)]),'confidence':z['number'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),DomainEvidenceSchema=z['object']({'domain':z['string']()['max'](0x40),'confidence':z['number']()['optional'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),ClaimEvidenceSchema=z['object']({'key':z['string']()['max'](0x40),'value':z['number'](),'confidence':z['number']()['optional'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),ProvenanceSchema=z['object']({'source':z['enum'](['caller_llm','human']),'model':z['string']()['max'](0x78)['optional'](),'prompt_version':z['string']()['max'](0x3c)['optional'](),'generated_at':z['number']()['int']()['nonnegative']()['optional']()})['strict'](),DiscoveryEvidenceSchema=z['object']({'industry':z['string']()['max'](0x40)['optional'](),'tags':z['array'](z['string']()['max'](0x40))['max'](0x14)['optional'](),'product_ref':z['string']()['max'](0x40)['optional'](),'english_summary':z['string']()['max'](0x258)['optional'](),'confidence':z['number']()['optional']()})['strict']();export const SemanticIRInputSchema=z['object']({'schema_version':z['union']([z['literal'](0x1),z['literal'](0x2)]),'locale':z['string']()['min'](0x2)['max'](0x23),'traits':z['array'](TraitEvidenceSchema)['max'](0x14)['optional'](),'domains':z['array'](DomainEvidenceSchema)['max'](0xa)['optional'](),'claims':z['array'](ClaimEvidenceSchema)['max'](0xa)['optional'](),'discovery':DiscoveryEvidenceSchema['optional'](),'provenance':ProvenanceSchema})['strict']();export function semanticIrDigest(a){return createHash('sha256')['update'](JSON['stringify'](a))['digest']('hex');}function traitOrder(a){return TRAIT_KEYS['indexOf'](a);}function vocabularyPreview(a,b=0xc){const c=a['slice'](0x0,b)['join'](',\x20');return a['length']>b?c+',\x20…\x20('+a['length']+'\x20total)':c;}function normalizeDiscovery(a,b){const c=new Set();for(const h of a?.['tags']??[]){const i=h['trim']()['toLowerCase']();if(!i)continue;if(!isDiscoveryTag(i)){b['push']('unknown\x20discovery\x20tag\x20\x27'+h+'\x27\x20ignored\x20(vocabulary:\x20'+vocabularyPreview(DISCOVERY_TAG_VOCABULARY)+')');continue;}c['add'](i);}let d;if(a?.['industry']!==undefined){const j=resolveIndustryName(a['industry']);!j||!isRegisteredIndustry(j)?b['push']('unknown\x20discovery\x20industry\x20\x27'+a['industry']+'\x27\x20ignored\x20(not\x20a\x20registered\x20industry)'):d=j;}let e;if(a?.['product_ref']!==undefined){const k=a['product_ref']['trim']()['toLowerCase']();!DISCOVERY_PRODUCT_REFS['includes'](k)?b['push']('unknown\x20discovery\x20product_ref\x20\x27'+a['product_ref']+'\x27\x20ignored\x20'+('(builtin\x20benchmark\x20products:\x20'+vocabularyPreview(DISCOVERY_PRODUCT_REFS)+')')):e=k;}const f=a?.['english_summary']?.['trim'](),g={'tags':[...c]['sort']()};if(d)g['industry']=d;if(e)g['product_ref']=e;if(f)g['english_summary']=f;if(a?.['confidence']!==undefined){if(!Number['isFinite'](a['confidence']))b['push']('discovery\x20confidence\x20is\x20not\x20finite;\x20discovery\x20evidence\x20ignored\x20at\x20match\x20time');else{const l=Math['max'](0x0,Math['min'](0x1,a['confidence']));l!==a['confidence']&&b['push']('discovery\x20confidence\x20'+a['confidence']+'\x20clamped\x20to\x20'+l),l<EVIDENCE_THRESHOLD&&b['push']('discovery\x20confidence\x20'+l+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied')),g['confidence']=l;}}return g;}function anchorEvidence(a,b,c,d){if(a===undefined)return{'span':c['span'],'quote':c['quote']};if(c['quote']!==undefined){const e=a['indexOf'](c['quote']);if(e<0x0)return d['push'](b+'\x20quote\x20was\x20not\x20found\x20verbatim\x20in\x20the\x20source\x20text;\x20evidence\x20dropped'),undefined;const f={'start':e,'end':e+c['quote']['length']};return c['span']&&(c['span']['start']!==f['start']||c['span']['end']!==f['end'])&&d['push'](b+'\x20span\x20re-anchored\x20to\x20the\x20quoted\x20text\x20('+f['start']+'-'+f['end']+')'),{'span':f,'quote':c['quote']};}if(c['span']){if(c['span']['end']>a['length'])return d['push'](b+'\x20span\x20ends\x20past\x20the\x20source\x20text\x20('+c['span']['end']+'\x20>\x20'+a['length']+');\x20evidence\x20dropped'),undefined;if(!a['slice'](c['span']['start'],c['span']['end'])['trim']())return d['push'](b+'\x20span\x20covers\x20no\x20text;\x20evidence\x20dropped'),undefined;return{'span':c['span']};}return{};}export function normalizeSemanticIR(a,b={}){const e=SemanticIRInputSchema['safeParse'](a);if(!e['success']){const x=e['error']['issues']['map'](y=>(y['path']['length']>0x0?y['path']['join']('.'):'(root)')+':\x20'+y['message'])['join'](';\x20');throw new Error('semantic_ir\x20rejected:\x20'+x);}const f=[],g=[];for(const y of e['data']['traits']??[]){if(!TRAIT_KEYS['includes'](y['trait'])){f['push']('unknown\x20trait\x20\x27'+y['trait']+'\x27\x20ignored\x20(vocabulary:\x20'+TRAIT_KEYS['join'](',\x20')+')');continue;}const A=y['trait'],B=BOOLEAN_TRAIT_KEYS['includes'](A);if(B){if(typeof y['value']!=='boolean'){f['push']('trait\x20\x27'+A+'\x27\x20is\x20boolean;\x20value\x20\x27'+String(y['value'])+'\x27\x20ignored');continue;}}else{const F=ENUM_TRAIT_SCALES[A];if(!F||typeof y['value']!=='string'||!F['includes'](y['value'])){f['push']('trait\x20\x27'+A+'\x27\x20expects\x20one\x20of\x20['+(F??[])['join'](',\x20')+'];\x20'+('value\x20\x27'+String(y['value'])+'\x27\x20ignored'));continue;}}if(!Number['isFinite'](y['confidence'])){f['push']('trait\x20\x27'+A+'\x27\x20confidence\x20is\x20not\x20finite;\x20evidence\x20ignored');continue;}const C=Math['max'](0x0,Math['min'](0x1,y['confidence']));C!==y['confidence']&&f['push']('trait\x20\x27'+A+'\x27\x20confidence\x20'+y['confidence']+'\x20clamped\x20to\x20'+C);C<EVIDENCE_THRESHOLD&&f['push']('trait\x20\x27'+A+'\x27\x20confidence\x20'+C+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));let D;y['span']&&(y['span']['end']<y['span']['start']?f['push']('trait\x20\x27'+A+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped'):D={'start':y['span']['start'],'end':y['span']['end']});const E={'trait':A,'value':y['value'],'confidence':C};if(D)E['span']=D;if(y['quote']!==undefined)E['quote']=y['quote'];g['push'](E);}g['sort']((G,H)=>{const I=traitOrder(G['trait'])-traitOrder(H['trait']);if(I!==0x0)return I;if(H['confidence']!==G['confidence'])return H['confidence']-G['confidence'];return JSON['stringify'](G['value'])['localeCompare'](JSON['stringify'](H['value']));});const h=[],i=new Map();for(const G of g){const H=i['get'](G['trait']);if(!H){i['set'](G['trait'],G),h['push'](G);continue;}H['value']!==G['value']&&f['push']('conflicting\x20evidence\x20for\x20\x27'+G['trait']+'\x27:\x20'+('kept\x20\x27'+String(H['value'])+'\x27\x20(confidence\x20'+H['confidence']+')\x20over\x20')+('\x27'+String(G['value'])+'\x27\x20(confidence\x20'+G['confidence']+')'));}const j=[];for(const I of e['data']['domains']??[]){if(!DOMAIN_PRIORS['some'](M=>M['domain']===I['domain'])){f['push']('unknown\x20domain\x20\x27'+I['domain']+'\x27\x20ignored\x20(vocabulary:\x20'+DOMAIN_PRIORS['map'](M=>M['domain'])['join'](',\x20')+')');continue;}const J=I['confidence']??0x1;if(!Number['isFinite'](J)){f['push']('domain\x20\x27'+I['domain']+'\x27\x20confidence\x20is\x20not\x20finite;\x20evidence\x20ignored');continue;}const K=Math['max'](0x0,Math['min'](0x1,J));K!==J&&f['push']('domain\x20\x27'+I['domain']+'\x27\x20confidence\x20'+J+'\x20clamped\x20to\x20'+K);K<EVIDENCE_THRESHOLD&&f['push']('domain\x20\x27'+I['domain']+'\x27\x20confidence\x20'+K+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));const L={'domain':I['domain'],'confidence':K};if(I['span']&&I['span']['end']>=I['span']['start'])L['span']={'start':I['span']['start'],'end':I['span']['end']};else{if(I['span'])f['push']('domain\x20\x27'+I['domain']+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped');}if(I['quote']!==undefined)L['quote']=I['quote'];j['push'](L);}j['sort']((M,N)=>{if(N['confidence']!==M['confidence'])return N['confidence']-M['confidence'];return M['domain']['localeCompare'](N['domain']);});const k=[],l=new Set();for(const M of j){if(l['has'](M['domain']))continue;l['add'](M['domain']),k['push'](M);}const m=[];for(const N of e['data']['claims']??[]){if(!SEMANTIC_CLAIM_KEYS['includes'](N['key'])){f['push']('unknown\x20claim\x20\x27'+N['key']+'\x27\x20ignored\x20(vocabulary:\x20'+SEMANTIC_CLAIM_KEYS['join'](',\x20')+')');continue;}const O=N['key'];if(!Number['isFinite'](N['value'])){f['push']('claim\x20\x27'+O+'\x27\x20value\x20is\x20not\x20finite;\x20ignored');continue;}if(N['value']<0x0){f['push']('claim\x20\x27'+O+'\x27\x20value\x20'+N['value']+'\x20is\x20negative;\x20ignored');continue;}const P=N['confidence']??0x1;if(!Number['isFinite'](P)){f['push']('claim\x20\x27'+O+'\x27\x20confidence\x20is\x20not\x20finite;\x20claim\x20ignored');continue;}const Q=Math['max'](0x0,Math['min'](0x1,P));Q!==P&&f['push']('claim\x20\x27'+O+'\x27\x20confidence\x20'+P+'\x20clamped\x20to\x20'+Q);Q<EVIDENCE_THRESHOLD&&f['push']('claim\x20\x27'+O+'\x27\x20confidence\x20'+Q+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));const R={'key':O,'value':N['value'],'confidence':Q};N['span']&&(N['span']['end']<N['span']['start']?f['push']('claim\x20\x27'+O+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped'):R['span']={'start':N['span']['start'],'end':N['span']['end']});if(N['quote']!==undefined)R['quote']=N['quote'];m['push'](R);}m['sort']((S,T)=>{if(S['key']!==T['key'])return S['key']<T['key']?-0x1:0x1;return T['confidence']-S['confidence'];});const n=[],o=new Map();for(const S of m){const T=o['get'](S['key']);if(!T){o['set'](S['key'],S),n['push'](S);continue;}T['value']!==S['value']&&f['push']('conflicting\x20evidence\x20for\x20claim\x20\x27'+S['key']+'\x27:\x20'+('kept\x20'+T['value']+'\x20(confidence\x20'+T['confidence']+')\x20over\x20')+(S['value']+'\x20(confidence\x20'+S['confidence']+')'));}const p=b['source_text']&&b['source_text']['trim']()?b['source_text']:undefined,q=[];for(const U of h){const V=anchorEvidence(p,'trait\x20\x27'+U['trait']+'\x27',U,f);if(!V)continue;if(V['span'])U['span']=V['span'];else delete U['span'];if(V['quote']!==undefined)U['quote']=V['quote'];q['push'](U);}const r=[];for(const W of k){const X=anchorEvidence(p,'domain\x20\x27'+W['domain']+'\x27',W,f);if(!X)continue;if(X['span'])W['span']=X['span'];else delete W['span'];if(X['quote']!==undefined)W['quote']=X['quote'];r['push'](W);}const s=[];for(const Y of n){const Z=anchorEvidence(p,'claim\x20\x27'+Y['key']+'\x27',Y,f);if(!Z)continue;if(Z['span'])Y['span']=Z['span'];else delete Y['span'];if(Z['quote']!==undefined)Y['quote']=Z['quote'];s['push'](Y);}const t=normalizeDiscovery(e['data']['discovery'],f),u=t['industry']!==undefined||t['product_ref']!==undefined||t['english_summary']!==undefined||t['tags']['length']>0x0;q['length']===0x0&&r['length']===0x0&&s['length']===0x0&&!u&&f['push']('semantic_ir\x20carries\x20no\x20usable\x20evidence;\x20keyword\x20inference\x20is\x20the\x20only\x20signal');const v={'source':e['data']['provenance']['source']};if(e['data']['provenance']['model']!==undefined)v['model']=e['data']['provenance']['model'];e['data']['provenance']['prompt_version']!==undefined&&(v['prompt_version']=e['data']['provenance']['prompt_version']);e['data']['provenance']['generated_at']!==undefined&&(v['generated_at']=e['data']['provenance']['generated_at']);const w={'schema_version':SEMANTIC_IR_SCHEMA_VERSION,'locale':e['data']['locale'],'traits':q,'domains':r,'claims':s,'discovery':t,'provenance':v};return{'ir':w,'digest':semanticIrDigest(w),'issues':f};}export function discoverySignal(a){const b=a['discovery'];if((b['confidence']??0x1)<EVIDENCE_THRESHOLD)return undefined;if(b['industry']===undefined&&b['product_ref']===undefined&&b['english_summary']===undefined&&b['tags']['length']===0x0)return undefined;return b;}export function claimNumber(a,b){const c=a['claims']['find'](d=>d['key']===b&&d['confidence']>=EVIDENCE_THRESHOLD);return c?.['value'];}export function mergeSemanticIR(a,b){const c={...a['traits']},d={...a['trait_confidence']},e=[];for(const h of b['traits']){if(h['confidence']<EVIDENCE_THRESHOLD)continue;const i=a['trait_confidence'][h['trait']],j=a['traits'][h['trait']];i!==undefined&&j!==h['value']?(e['push']({'trait':h['trait'],'keyword_value':j,'keyword_confidence':i,'ir_value':h['value'],'ir_confidence':h['confidence']}),d[h['trait']]=h['confidence']):d[h['trait']]=Math['max'](i??0x0,h['confidence']),c[h['trait']]=h['value'];}const f=Object['values'](d)['filter'](k=>(k??0x0)>=EVIDENCE_THRESHOLD)['length'],g=Math['min'](0x1,Math['max'](a['confidence'],f/TRAIT_KEYS['length']));return{'traits':c,'confidence':g,'matched_keywords':[...a['matched_keywords']],'trait_confidence':d,'conflicts':e};}export function domainPriorsFromIR(a){const b=[];for(const c of a['domains']){if(c['confidence']<EVIDENCE_THRESHOLD)continue;const e=DOMAIN_PRIORS['find'](f=>f['domain']===c['domain']);if(!e)continue;b['push']({'domain':e['domain'],'matched_keywords':[],'industries':[...e['industries']],'boost':e['boost'],'source':'semantic_ir'});}return b;}export function mergeDomainPriors(a,b){const c=new Map();for(const d of a){c['set'](d['domain'],{...d,'source':d['source']??'keyword'});}for(const e of b){const f=c['get'](e['domain']);if(!f){c['set'](e['domain'],e);continue;}c['set'](e['domain'],{...f,'matched_keywords':[...new Set([...f['matched_keywords'],...e['matched_keywords']])],'industries':[...new Set([...f['industries'],...e['industries']])],'boost':Math['max'](f['boost'],e['boost']),'source':'both'});}return Array['from'](c['values']());}
|
|
1
|
+
import{createHash}from'node:crypto';import{z}from'zod';import{DISCOVERY_PRODUCT_REFS,DISCOVERY_TAG_VOCABULARY,isDiscoveryTag}from'./builtin-templates.js';import{BOOLEAN_TRAIT_KEYS,DOMAIN_PRIORS,ENUM_TRAIT_SCALES,EVIDENCE_THRESHOLD}from'./industry-generalizer.js';import{isRegisteredIndustry,resolveIndustryName}from'./industry-registry.js';export const SEMANTIC_IR_SCHEMA_VERSION=0x2;export const SEMANTIC_IR_ACCEPTED_INPUT_VERSIONS=[0x1,0x2];export const TRAIT_KEYS=[...BOOLEAN_TRAIT_KEYS,...Object['keys'](ENUM_TRAIT_SCALES)];export const SEMANTIC_CLAIM_KEYS=['reward_pool_amount','funding_threshold_amount','min_order_price_amount'];function levenshteinDistance(c,d){if(c===d)return 0x0;if(c['length']===0x0)return d['length'];if(d['length']===0x0)return c['length'];let e=Array['from']({'length':d['length']+0x1},(f,g)=>g);for(let f=0x1;f<=c['length'];f++){const g=[f];for(let h=0x1;h<=d['length'];h++){g[h]=Math['min'](e[h]+0x1,g[h-0x1]+0x1,e[h-0x1]+(c[f-0x1]===d[h-0x1]?0x0:0x1));}e=g;}return e[d['length']];}export function resolveClaimKey(a){if(SEMANTIC_CLAIM_KEYS['includes'](a))return{'key':a};for(const e of SEMANTIC_CLAIM_KEYS){if(e['replace'](/_amount$/,'')===a)return{'key':e,'note':'untyped\x20alias\x20—\x20the\x20canonical\x20key\x20appends\x20\x27_amount\x27'};}const b=SEMANTIC_CLAIM_KEYS['flatMap'](f=>[{'key':f,'form':f},{'key':f,'form':f['replace'](/_amount$/,'')}]);let c,d=![];for(const {key:f,form:g}of b){const h=levenshteinDistance(a['toLowerCase'](),g);if(h>0x2)continue;if(!c||h<c['distance'])c={'key':f,'distance':h},d=![];else h===c['distance']&&f!==c['key']&&(d=!![]);}if(c&&!d)return{'key':c['key'],'note':'closest\x20vocabulary\x20key,\x20Levenshtein\x20distance\x20'+c['distance']};return undefined;}const SpanSchema=z['object']({'start':z['number']()['int']()['nonnegative'](),'end':z['number']()['int']()['nonnegative']()})['strict'](),TraitEvidenceSchema=z['object']({'trait':z['string']()['max'](0x40),'value':z['union']([z['boolean'](),z['string']()['max'](0x20)]),'confidence':z['number'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),DomainEvidenceSchema=z['object']({'domain':z['string']()['max'](0x40),'confidence':z['number']()['optional'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),ClaimEvidenceSchema=z['object']({'key':z['string']()['max'](0x40),'value':z['number'](),'confidence':z['number']()['optional'](),'span':SpanSchema['optional'](),'quote':z['string']()['max'](0x12c)['optional']()})['strict'](),ProvenanceSchema=z['object']({'source':z['enum'](['caller_llm','human']),'model':z['string']()['max'](0x78)['optional'](),'prompt_version':z['string']()['max'](0x3c)['optional'](),'generated_at':z['number']()['int']()['nonnegative']()['optional']()})['strict'](),DiscoveryEvidenceSchema=z['object']({'industry':z['string']()['max'](0x40)['optional'](),'tags':z['array'](z['string']()['max'](0x40))['max'](0x14)['optional'](),'product_ref':z['string']()['max'](0x40)['optional'](),'english_summary':z['string']()['max'](0x258)['optional'](),'confidence':z['number']()['optional']()})['strict']();export const SemanticIRInputSchema=z['object']({'schema_version':z['union']([z['literal'](0x1),z['literal'](0x2)]),'locale':z['string']()['min'](0x2)['max'](0x23),'traits':z['array'](TraitEvidenceSchema)['max'](0x14)['optional'](),'domains':z['array'](DomainEvidenceSchema)['max'](0xa)['optional'](),'claims':z['array'](ClaimEvidenceSchema)['max'](0xa)['optional'](),'discovery':DiscoveryEvidenceSchema['optional'](),'provenance':ProvenanceSchema})['strict']();export function semanticIrDigest(a){return createHash('sha256')['update'](JSON['stringify'](a))['digest']('hex');}function traitOrder(a){return TRAIT_KEYS['indexOf'](a);}function vocabularyPreview(a,b=0xc){const c=a['slice'](0x0,b)['join'](',\x20');return a['length']>b?c+',\x20…\x20('+a['length']+'\x20total)':c;}function normalizeDiscovery(a,b){const c=new Set();for(const h of a?.['tags']??[]){const i=h['trim']()['toLowerCase']();if(!i)continue;if(!isDiscoveryTag(i)){b['push']('unknown\x20discovery\x20tag\x20\x27'+h+'\x27\x20ignored\x20(vocabulary:\x20'+vocabularyPreview(DISCOVERY_TAG_VOCABULARY)+')');continue;}c['add'](i);}let d;if(a?.['industry']!==undefined){const j=resolveIndustryName(a['industry']);!j||!isRegisteredIndustry(j)?b['push']('unknown\x20discovery\x20industry\x20\x27'+a['industry']+'\x27\x20ignored\x20(not\x20a\x20registered\x20industry)'):d=j;}let e;if(a?.['product_ref']!==undefined){const k=a['product_ref']['trim']()['toLowerCase']();!DISCOVERY_PRODUCT_REFS['includes'](k)?b['push']('unknown\x20discovery\x20product_ref\x20\x27'+a['product_ref']+'\x27\x20ignored\x20'+('(builtin\x20benchmark\x20products:\x20'+vocabularyPreview(DISCOVERY_PRODUCT_REFS)+')')):e=k;}const f=a?.['english_summary']?.['trim'](),g={'tags':[...c]['sort']()};if(d)g['industry']=d;if(e)g['product_ref']=e;if(f)g['english_summary']=f;if(a?.['confidence']!==undefined){if(!Number['isFinite'](a['confidence']))b['push']('discovery\x20confidence\x20is\x20not\x20finite;\x20discovery\x20evidence\x20ignored\x20at\x20match\x20time');else{const l=Math['max'](0x0,Math['min'](0x1,a['confidence']));l!==a['confidence']&&b['push']('discovery\x20confidence\x20'+a['confidence']+'\x20clamped\x20to\x20'+l),l<EVIDENCE_THRESHOLD&&b['push']('discovery\x20confidence\x20'+l+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied')),g['confidence']=l;}}return g;}function anchorEvidence(a,b,c,d){if(a===undefined)return{'span':c['span'],'quote':c['quote']};if(c['quote']!==undefined){const e=a['indexOf'](c['quote']);if(e<0x0)return d['push'](b+'\x20quote\x20was\x20not\x20found\x20verbatim\x20in\x20the\x20source\x20text;\x20evidence\x20dropped'),undefined;const f={'start':e,'end':e+c['quote']['length']};return c['span']&&(c['span']['start']!==f['start']||c['span']['end']!==f['end'])&&d['push'](b+'\x20span\x20re-anchored\x20to\x20the\x20quoted\x20text\x20('+f['start']+'-'+f['end']+')'),{'span':f,'quote':c['quote']};}if(c['span']){if(c['span']['end']>a['length'])return d['push'](b+'\x20span\x20ends\x20past\x20the\x20source\x20text\x20('+c['span']['end']+'\x20>\x20'+a['length']+');\x20evidence\x20dropped'),undefined;if(!a['slice'](c['span']['start'],c['span']['end'])['trim']())return d['push'](b+'\x20span\x20covers\x20no\x20text;\x20evidence\x20dropped'),undefined;return{'span':c['span']};}return{};}export function normalizeSemanticIR(a,b={}){const e=SemanticIRInputSchema['safeParse'](a);if(!e['success']){const x=e['error']['issues']['map'](y=>(y['path']['length']>0x0?y['path']['join']('.'):'(root)')+':\x20'+y['message'])['join'](';\x20');throw new Error('semantic_ir\x20rejected:\x20'+x);}const f=[],g=[];for(const y of e['data']['traits']??[]){if(!TRAIT_KEYS['includes'](y['trait'])){f['push']('unknown\x20trait\x20\x27'+y['trait']+'\x27\x20ignored\x20(vocabulary:\x20'+TRAIT_KEYS['join'](',\x20')+')');continue;}const A=y['trait'],B=BOOLEAN_TRAIT_KEYS['includes'](A);if(B){if(typeof y['value']!=='boolean'){f['push']('trait\x20\x27'+A+'\x27\x20is\x20boolean;\x20value\x20\x27'+String(y['value'])+'\x27\x20ignored');continue;}}else{const F=ENUM_TRAIT_SCALES[A];if(!F||typeof y['value']!=='string'||!F['includes'](y['value'])){f['push']('trait\x20\x27'+A+'\x27\x20expects\x20one\x20of\x20['+(F??[])['join'](',\x20')+'];\x20'+('value\x20\x27'+String(y['value'])+'\x27\x20ignored'));continue;}}if(!Number['isFinite'](y['confidence'])){f['push']('trait\x20\x27'+A+'\x27\x20confidence\x20is\x20not\x20finite;\x20evidence\x20ignored');continue;}const C=Math['max'](0x0,Math['min'](0x1,y['confidence']));C!==y['confidence']&&f['push']('trait\x20\x27'+A+'\x27\x20confidence\x20'+y['confidence']+'\x20clamped\x20to\x20'+C);C<EVIDENCE_THRESHOLD&&f['push']('trait\x20\x27'+A+'\x27\x20confidence\x20'+C+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));let D;y['span']&&(y['span']['end']<y['span']['start']?f['push']('trait\x20\x27'+A+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped'):D={'start':y['span']['start'],'end':y['span']['end']});const E={'trait':A,'value':y['value'],'confidence':C};if(D)E['span']=D;if(y['quote']!==undefined)E['quote']=y['quote'];g['push'](E);}g['sort']((G,H)=>{const I=traitOrder(G['trait'])-traitOrder(H['trait']);if(I!==0x0)return I;if(H['confidence']!==G['confidence'])return H['confidence']-G['confidence'];return JSON['stringify'](G['value'])['localeCompare'](JSON['stringify'](H['value']));});const h=[],i=new Map();for(const G of g){const H=i['get'](G['trait']);if(!H){i['set'](G['trait'],G),h['push'](G);continue;}H['value']!==G['value']&&f['push']('conflicting\x20evidence\x20for\x20\x27'+G['trait']+'\x27:\x20'+('kept\x20\x27'+String(H['value'])+'\x27\x20(confidence\x20'+H['confidence']+')\x20over\x20')+('\x27'+String(G['value'])+'\x27\x20(confidence\x20'+G['confidence']+')'));}const j=[];for(const I of e['data']['domains']??[]){if(!DOMAIN_PRIORS['some'](M=>M['domain']===I['domain'])){f['push']('unknown\x20domain\x20\x27'+I['domain']+'\x27\x20ignored\x20(vocabulary:\x20'+DOMAIN_PRIORS['map'](M=>M['domain'])['join'](',\x20')+')');continue;}const J=I['confidence']??0x1;if(!Number['isFinite'](J)){f['push']('domain\x20\x27'+I['domain']+'\x27\x20confidence\x20is\x20not\x20finite;\x20evidence\x20ignored');continue;}const K=Math['max'](0x0,Math['min'](0x1,J));K!==J&&f['push']('domain\x20\x27'+I['domain']+'\x27\x20confidence\x20'+J+'\x20clamped\x20to\x20'+K);K<EVIDENCE_THRESHOLD&&f['push']('domain\x20\x27'+I['domain']+'\x27\x20confidence\x20'+K+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));const L={'domain':I['domain'],'confidence':K};if(I['span']&&I['span']['end']>=I['span']['start'])L['span']={'start':I['span']['start'],'end':I['span']['end']};else{if(I['span'])f['push']('domain\x20\x27'+I['domain']+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped');}if(I['quote']!==undefined)L['quote']=I['quote'];j['push'](L);}j['sort']((M,N)=>{if(N['confidence']!==M['confidence'])return N['confidence']-M['confidence'];return M['domain']['localeCompare'](N['domain']);});const k=[],l=new Set();for(const M of j){if(l['has'](M['domain']))continue;l['add'](M['domain']),k['push'](M);}const m=[];for(const N of e['data']['claims']??[]){let O=N['key'];if(!SEMANTIC_CLAIM_KEYS['includes'](N['key'])){const S=resolveClaimKey(N['key']);if(!S){f['push']('unknown\x20claim\x20\x27'+N['key']+'\x27\x20ignored\x20(vocabulary:\x20'+SEMANTIC_CLAIM_KEYS['join'](',\x20')+';\x20'+'no\x20alias\x20or\x20near-match\x20within\x20Levenshtein\x20distance\x202)');continue;}O=S['key'],f['push']('claim\x20\x27'+N['key']+'\x27\x20resolved\x20to\x20\x27'+O+'\x27\x20('+S['note']+')');}if(!Number['isFinite'](N['value'])){f['push']('claim\x20\x27'+O+'\x27\x20value\x20is\x20not\x20finite;\x20ignored');continue;}if(N['value']<0x0){f['push']('claim\x20\x27'+O+'\x27\x20value\x20'+N['value']+'\x20is\x20negative;\x20ignored');continue;}const P=N['confidence']??0x1;if(!Number['isFinite'](P)){f['push']('claim\x20\x27'+O+'\x27\x20confidence\x20is\x20not\x20finite;\x20claim\x20ignored');continue;}const Q=Math['max'](0x0,Math['min'](0x1,P));Q!==P&&f['push']('claim\x20\x27'+O+'\x27\x20confidence\x20'+P+'\x20clamped\x20to\x20'+Q);Q<EVIDENCE_THRESHOLD&&f['push']('claim\x20\x27'+O+'\x27\x20confidence\x20'+Q+'\x20is\x20below\x20the\x20evidence\x20threshold\x20'+(EVIDENCE_THRESHOLD+';\x20recorded\x20but\x20not\x20applied'));const R={'key':O,'value':N['value'],'confidence':Q};N['span']&&(N['span']['end']<N['span']['start']?f['push']('claim\x20\x27'+O+'\x27\x20span\x20has\x20end\x20<\x20start;\x20span\x20dropped'):R['span']={'start':N['span']['start'],'end':N['span']['end']});if(N['quote']!==undefined)R['quote']=N['quote'];m['push'](R);}m['sort']((T,U)=>{if(T['key']!==U['key'])return T['key']<U['key']?-0x1:0x1;return U['confidence']-T['confidence'];});const n=[],o=new Map();for(const T of m){const U=o['get'](T['key']);if(!U){o['set'](T['key'],T),n['push'](T);continue;}U['value']!==T['value']&&f['push']('conflicting\x20evidence\x20for\x20claim\x20\x27'+T['key']+'\x27:\x20'+('kept\x20'+U['value']+'\x20(confidence\x20'+U['confidence']+')\x20over\x20')+(T['value']+'\x20(confidence\x20'+T['confidence']+')'));}const p=b['source_text']&&b['source_text']['trim']()?b['source_text']:undefined,q=[];for(const V of h){const W=anchorEvidence(p,'trait\x20\x27'+V['trait']+'\x27',V,f);if(!W)continue;if(W['span'])V['span']=W['span'];else delete V['span'];if(W['quote']!==undefined)V['quote']=W['quote'];q['push'](V);}const r=[];for(const X of k){const Y=anchorEvidence(p,'domain\x20\x27'+X['domain']+'\x27',X,f);if(!Y)continue;if(Y['span'])X['span']=Y['span'];else delete X['span'];if(Y['quote']!==undefined)X['quote']=Y['quote'];r['push'](X);}const s=[];for(const Z of n){const a0=anchorEvidence(p,'claim\x20\x27'+Z['key']+'\x27',Z,f);if(!a0)continue;if(a0['span'])Z['span']=a0['span'];else delete Z['span'];if(a0['quote']!==undefined)Z['quote']=a0['quote'];s['push'](Z);}const t=normalizeDiscovery(e['data']['discovery'],f),u=t['industry']!==undefined||t['product_ref']!==undefined||t['english_summary']!==undefined||t['tags']['length']>0x0;q['length']===0x0&&r['length']===0x0&&s['length']===0x0&&!u&&f['push']('semantic_ir\x20carries\x20no\x20usable\x20evidence;\x20keyword\x20inference\x20is\x20the\x20only\x20signal');const v={'source':e['data']['provenance']['source']};if(e['data']['provenance']['model']!==undefined)v['model']=e['data']['provenance']['model'];e['data']['provenance']['prompt_version']!==undefined&&(v['prompt_version']=e['data']['provenance']['prompt_version']);e['data']['provenance']['generated_at']!==undefined&&(v['generated_at']=e['data']['provenance']['generated_at']);const w={'schema_version':SEMANTIC_IR_SCHEMA_VERSION,'locale':e['data']['locale'],'traits':q,'domains':r,'claims':s,'discovery':t,'provenance':v};return{'ir':w,'digest':semanticIrDigest(w),'issues':f};}export function discoverySignal(a){const b=a['discovery'];if((b['confidence']??0x1)<EVIDENCE_THRESHOLD)return undefined;if(b['industry']===undefined&&b['product_ref']===undefined&&b['english_summary']===undefined&&b['tags']['length']===0x0)return undefined;return b;}export function claimNumber(a,b){const c=a['claims']['find'](d=>d['key']===b&&d['confidence']>=EVIDENCE_THRESHOLD);return c?.['value'];}export function mergeSemanticIR(a,b){const c={...a['traits']},d={...a['trait_confidence']},e=[];for(const h of b['traits']){if(h['confidence']<EVIDENCE_THRESHOLD)continue;const i=a['trait_confidence'][h['trait']],j=a['traits'][h['trait']];i!==undefined&&j!==h['value']?(e['push']({'trait':h['trait'],'keyword_value':j,'keyword_confidence':i,'ir_value':h['value'],'ir_confidence':h['confidence']}),d[h['trait']]=h['confidence']):d[h['trait']]=Math['max'](i??0x0,h['confidence']),c[h['trait']]=h['value'];}const f=Object['values'](d)['filter'](k=>(k??0x0)>=EVIDENCE_THRESHOLD)['length'],g=Math['min'](0x1,Math['max'](a['confidence'],f/TRAIT_KEYS['length']));return{'traits':c,'confidence':g,'matched_keywords':[...a['matched_keywords']],'trait_confidence':d,'conflicts':e};}export function domainPriorsFromIR(a){const b=[];for(const c of a['domains']){if(c['confidence']<EVIDENCE_THRESHOLD)continue;const e=DOMAIN_PRIORS['find'](f=>f['domain']===c['domain']);if(!e)continue;b['push']({'domain':e['domain'],'matched_keywords':[],'industries':[...e['industries']],'boost':e['boost'],'source':'semantic_ir'});}return b;}export function mergeDomainPriors(a,b){const c=new Map();for(const d of a){c['set'](d['domain'],{...d,'source':d['source']??'keyword'});}for(const e of b){const f=c['get'](e['domain']);if(!f){c['set'](e['domain'],e);continue;}c['set'](e['domain'],{...f,'matched_keywords':[...new Set([...f['matched_keywords'],...e['matched_keywords']])],'industries':[...new Set([...f['industries'],...e['industries']])],'boost':Math['max'](f['boost'],e['boost']),'source':'both'});}return Array['from'](c['values']());}
|
|
@@ -58,7 +58,7 @@ export declare const SERVICE_LISTING_REFUND_GATES: {
|
|
|
58
58
|
readonly rationale: "A zero-priced listing plus an allocation-free 0-amount order produced stores whose entire economics live outside the chain. Repricing an EXISTING sale down to zero stays legal and is caught at buy time by the zero-total order gate.";
|
|
59
59
|
};
|
|
60
60
|
readonly restock: {
|
|
61
|
-
readonly rule: "Refund restocking is opt-in per SKU: the merchant marks an ALIVE sale with the restock flag (305), then a refunded order's purchased units can be put back on shelf (305). Two-pass on-chain (validate every line, then apply) — ALL lines restock or NOTHING mutates. Unflagged or delisted lines abort E_RESTOCK_NOT_FLAGGED = 46 / E_SALE_ITEM_NOT_FOUND. Quantities come from the order's purchase rows. ONCE-PER-ORDER: the restock operation stamps the order with a RestockStamp dynamic field and a second call for the same order aborts E_RESTOCK_ALREADY_APPLIED = 49 (a replay would stack the purchased units again, an unbounded +quantity). OWNERSHIP-BOUND: only an order whose service field is THIS service restocks here — a foreign order aborts E_ORDER_SERVICE_NOT_MATCH = 26. The applied state
|
|
61
|
+
readonly rule: "Refund restocking is opt-in per SKU: the merchant marks an ALIVE sale with the restock flag (305), then a refunded order's purchased units can be put back on shelf (305). Two-pass on-chain (validate every line, then apply) — ALL lines restock or NOTHING mutates. Unflagged or delisted lines abort E_RESTOCK_NOT_FLAGGED = 46 / E_SALE_ITEM_NOT_FOUND. Quantities come from the order's purchase rows. ONCE-PER-ORDER: the restock operation stamps the order with a RestockStamp dynamic field and a second call for the same order aborts E_RESTOCK_ALREADY_APPLIED = 49 (a replay would stack the purchased units again, an unbounded +quantity). OWNERSHIP-BOUND: only an order whose service field is THIS service restocks here — a foreign order aborts E_ORDER_SERVICE_NOT_MATCH = 26. The applied state lives in a RestockStamp dynamic field on the service (no public query primitive); the MCP restock op:'order' pre-gate reads that stamp pre-send and refuses a replay without burning gas.";
|
|
62
62
|
readonly events: "StockRestockedEvent per line (service, order, item, quantity, time).";
|
|
63
63
|
};
|
|
64
64
|
readonly dismissal_conclusion: {
|