@wowok/agent-mcp 3.3.9 → 3.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/chain-semantics/composition-truth.d.ts +102 -0
- package/dist/chain-semantics/composition-truth.js +1 -0
- package/dist/chain-semantics/eval-order.js +1 -1
- package/dist/chain-semantics/field-capability.js +1 -1
- package/dist/chain-semantics/freeze-map.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/guard-verbs.js +1 -1
- package/dist/chain-semantics/index.d.ts +1 -0
- package/dist/chain-semantics/index.js +1 -1
- package/dist/chain-semantics/object-graph.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 +26 -4
- 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 +26 -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 +22 -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.d.ts +61 -0
- package/dist/composition/param-disclosure.js +1 -0
- 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 +17 -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/customer/account-events.js +1 -1
- package/dist/data/api/api.spec.js +1 -1
- package/dist/data/api/cli.js +1 -1
- package/dist/data/api/server.d.ts +1 -0
- package/dist/data/api/server.js +1 -1
- package/dist/data/projection/store.d.ts +3 -1
- package/dist/data/projection/store.js +1 -1
- package/dist/data/projection/types.d.ts +32 -0
- package/dist/data/sync/cdc.d.ts +1 -2
- package/dist/data/sync/cdc.js +1 -1
- package/dist/data/sync/cdc.spec.js +1 -1
- package/dist/data/sync/store.d.ts +5 -0
- package/dist/data/sync/store.js +1 -1
- package/dist/data/sync/types.d.ts +2 -0
- 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/guard-scan.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/index.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/allocation-templates.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/arb-fund-facts.d.ts +1 -0
- package/dist/knowledge/arb-fund-facts.js +1 -1
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/arbitration-puzzle.js +1 -1
- package/dist/knowledge/arbitration-risk.d.ts +1 -0
- package/dist/knowledge/arbitration-risk.js +1 -1
- package/dist/knowledge/audit-rules.d.ts +2 -2
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/judgment-baselines.json +21 -2
- package/dist/knowledge/baselines/rules/allocation.json +6 -6
- package/dist/knowledge/baselines/rules/arb.json +2 -2
- package/dist/knowledge/baselines/rules/guard.json +11 -11
- package/dist/knowledge/baselines/rules/oracle.json +120 -0
- package/dist/knowledge/baselines/rules/order.json +1 -1
- package/dist/knowledge/baselines/rules/plan.json +385 -18
- package/dist/knowledge/baselines/rules/progress.json +20 -2
- package/dist/knowledge/baselines/semantic-facts.js +1 -1
- package/dist/knowledge/builtin-templates.d.ts +25 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/catalog-facts.d.ts +4 -0
- package/dist/knowledge/catalog-facts.js +1 -0
- package/dist/knowledge/commission-landing.js +1 -1
- package/dist/knowledge/component-schema.d.ts +64 -0
- package/dist/knowledge/component-schema.js +1 -0
- 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/entity-recipient-guard.js +1 -1
- package/dist/knowledge/event-semantics.js +1 -1
- package/dist/knowledge/fee-param-bindings.d.ts +26 -0
- package/dist/knowledge/fee-param-bindings.js +1 -0
- 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.d.ts +2 -2
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-anchor-reach.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-ledger.js +1 -1
- package/dist/knowledge/guard-lint.d.ts +1 -0
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-node-gates.d.ts +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/industry-strategy.js +1 -1
- package/dist/knowledge/jsonrpc-enum.d.ts +52 -3
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/knob-docs.d.ts +5 -0
- package/dist/knowledge/knob-docs.js +1 -0
- package/dist/knowledge/machine-templates.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 +4 -0
- package/dist/knowledge/onchain-constants.js +1 -1
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/param-schema.d.ts +93 -0
- package/dist/knowledge/param-schema.js +1 -0
- package/dist/knowledge/param-tiers.d.ts +25 -0
- package/dist/knowledge/param-tiers.js +1 -0
- package/dist/knowledge/passport-ledger.d.ts +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 +108 -0
- package/dist/knowledge/pattern-resolutions.js +1 -0
- 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/safety-rules.js +1 -1
- package/dist/knowledge/scenario-modes.d.ts +2 -0
- package/dist/knowledge/scenario-modes.js +1 -1
- package/dist/knowledge/scenario-topology.js +1 -1
- package/dist/knowledge/semantic-ir.d.ts +4 -0
- package/dist/knowledge/semantic-ir.js +1 -1
- package/dist/knowledge/service-allocation-semantics.js +1 -1
- package/dist/knowledge/service-ledger.d.ts +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-templates.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/strategy-manuals.d.ts +1 -1
- package/dist/knowledge/strategy-manuals.js +1 -1
- package/dist/knowledge/supply-chain.d.ts +9 -0
- package/dist/knowledge/supply-chain.js +1 -1
- package/dist/knowledge/template-loader.d.ts +114 -6
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-nav.d.ts +9 -0
- package/dist/knowledge/template-nav.js +1 -0
- package/dist/knowledge/template-prose.d.ts +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +95 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/template-test-profiles.d.ts +17 -0
- package/dist/knowledge/template-test-profiles.js +1 -0
- package/dist/knowledge/template-validation.d.ts +1 -0
- package/dist/knowledge/template-validation.js +1 -1
- package/dist/knowledge/tools-reference.js +1 -1
- package/dist/knowledge/treasury-templates.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +5 -0
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/radar-core.js +1 -1
- package/dist/participation/time-window.d.ts +37 -0
- package/dist/participation/time-window.js +1 -0
- 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.d.ts +1 -0
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +52 -22
- 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.d.ts +1 -0
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/reverse-mapping.d.ts +6 -0
- package/dist/playbooks/service-build/reverse-mapping.js +1 -1
- package/dist/playbooks/service-build/service-panorama.d.ts +2 -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/relationship/registry.js +1 -1
- package/dist/review/index.js +1 -1
- package/dist/review/repository.js +1 -1
- package/dist/runtime/instance-registry.d.ts +7 -1
- package/dist/runtime/instance-registry.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +106 -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/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +264 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +34 -6
- package/dist/schema/call/demand.d.ts +15 -6
- package/dist/schema/call/demand.js +1 -1
- package/dist/schema/call/error-codes.d.ts +1 -1
- package/dist/schema/call/error-codes.js +1 -1
- package/dist/schema/call/guard.d.ts +8 -8
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.d.ts +3 -0
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +32 -8
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.d.ts +26 -8
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/payment.d.ts +20 -8
- package/dist/schema/call/payment.js +1 -1
- package/dist/schema/call/permission-handler.js +1 -1
- package/dist/schema/call/permission.d.ts +330 -114
- package/dist/schema/call/permission.js +1 -1
- package/dist/schema/call/personal.d.ts +10 -4
- package/dist/schema/call/personal.js +1 -1
- package/dist/schema/call/progress.d.ts +16 -4
- package/dist/schema/call/reward.d.ts +10 -4
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.d.ts +1 -0
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +131 -43
- 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 +224 -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 +116 -1
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/industry-pack/index.d.ts +166 -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 +157 -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 +28 -0
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +343 -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 +251 -4
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +271 -78
- 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 +98 -2
- package/dist/schemas/benchmark_migration_operation.output.json +341 -12
- package/dist/schemas/benchmark_migration_operation.schema.json +42 -3
- package/dist/schemas/bridge_operation.output.json +98 -2
- package/dist/schemas/bridge_operation.schema.json +5 -5
- 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 +586 -4
- package/dist/schemas/evaluation_operation.schema.json +194 -3
- package/dist/schemas/goal_operation.schema.json +183 -0
- package/dist/schemas/guard2file.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/industry_pack_operation.output.json +771 -1
- package/dist/schemas/industry_pack_operation.schema.json +28 -4
- package/dist/schemas/keeper_operation.output.json +96 -2
- package/dist/schemas/local_cache_operation.output.json +98 -2
- package/dist/schemas/local_history_operation.output.json +98 -2
- package/dist/schemas/local_info_operation.output.json +98 -2
- package/dist/schemas/local_mark_operation.output.json +98 -2
- package/dist/schemas/machineNode2file.schema.json +1 -1
- package/dist/schemas/messenger_operation.output.json +107 -2
- package/dist/schemas/messenger_operation.schema.json +41 -34
- package/dist/schemas/monitor_events.output.json +96 -2
- package/dist/schemas/monitor_subscription.output.json +96 -2
- package/dist/schemas/onchain_events.output.json +108 -14
- package/dist/schemas/onchain_operations.output.json +326 -11
- package/dist/schemas/onchain_operations.schema.json +1343 -734
- package/dist/schemas/onchain_operations_allocation.schema.json +35 -19
- package/dist/schemas/onchain_operations_arbitration.schema.json +16 -8
- package/dist/schemas/onchain_operations_contact.schema.json +12 -4
- package/dist/schemas/onchain_operations_demand.schema.json +33 -17
- package/dist/schemas/onchain_operations_gen_passport.schema.json +12 -4
- package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_guard.schema.json +297 -111
- package/dist/schemas/onchain_operations_machine.schema.json +56 -39
- package/dist/schemas/onchain_operations_order.schema.json +67 -42
- package/dist/schemas/onchain_operations_payment.schema.json +27 -12
- package/dist/schemas/onchain_operations_permission.schema.json +363 -232
- package/dist/schemas/onchain_operations_personal.schema.json +43 -28
- package/dist/schemas/onchain_operations_progress.schema.json +49 -32
- package/dist/schemas/onchain_operations_proof.schema.json +12 -4
- package/dist/schemas/onchain_operations_repository.schema.json +17 -8
- package/dist/schemas/onchain_operations_reward.schema.json +36 -20
- package/dist/schemas/onchain_operations_service.schema.json +230 -130
- package/dist/schemas/onchain_operations_treasury.schema.json +36 -20
- package/dist/schemas/onchain_table_data.output.json +276 -19
- package/dist/schemas/onchain_table_data.schema.json +104 -64
- 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 +1054 -146
- package/dist/schemas/query_toolkit.schema.json +144 -13
- package/dist/schemas/schema_query.schema.json +1 -1
- package/dist/schemas/watch_operation.output.json +86 -3
- package/dist/schemas/wip_file.output.json +8 -0
- package/dist/schemas/workflow_operation.schema.json +5 -4
- package/dist/schemas/wowok_buildin_info.schema.json +1 -1
- package/dist/task/playbook.js +1 -1
- package/dist/tools/handlers/benchmark-migration.d.ts +12 -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/messenger.js +1 -1
- package/dist/tools/handlers/onchain.d.ts +24 -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/onchain.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/sanitize-output.js +1 -1
- package/dist/tools/sanitize-output.spec.js +1 -1
- package/dist/tools/transport-integrity.d.ts +7 -0
- package/dist/tools/transport-integrity.js +1 -0
- package/dist/tools/types.d.ts +1 -0
- package/dist/tools/upgrade-check.d.ts +22 -0
- package/dist/tools/upgrade-check.js +1 -1
- package/dist/tools/wrap.d.ts +6 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +7 -6
- 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,5 +1,7 @@
|
|
|
1
1
|
import { type BusinessIntent, type DeliverableDefinition, type PaymentIntent, type TrustIntent } from "./intent-analyzer.js";
|
|
2
|
-
import {
|
|
2
|
+
import type { SupplyChainPromise } from "../../composition/supply-chain-emit.js";
|
|
3
|
+
import type { JsonValue } from "../../composition/plan.js";
|
|
4
|
+
import { type CapabilityId } from "../../extensions/capability.js";
|
|
3
5
|
import type { IndustryTemplate } from "../../knowledge/template-loader.js";
|
|
4
6
|
export interface GuideState {
|
|
5
7
|
intent_text: string;
|
|
@@ -8,7 +10,7 @@ export interface GuideState {
|
|
|
8
10
|
deliverables?: DeliverableDefinition[];
|
|
9
11
|
payment_override?: Partial<PaymentIntent>;
|
|
10
12
|
trust_override?: Partial<TrustIntent>;
|
|
11
|
-
adopted_module_ids?:
|
|
13
|
+
adopted_module_ids?: CapabilityId[];
|
|
12
14
|
guard_resolutions?: Record<string, unknown>;
|
|
13
15
|
review_mode?: "review" | "review_reward" | "none";
|
|
14
16
|
reward_funding?: string;
|
|
@@ -19,7 +21,9 @@ export interface GuideState {
|
|
|
19
21
|
affiliate_mode?: "commission" | "none";
|
|
20
22
|
crowdfunding_mode?: "threshold" | "flexible" | "none";
|
|
21
23
|
logistics_mode?: "none" | "carrier" | "merchant_managed" | "courier" | "pickup_point";
|
|
24
|
+
supply_chain?: SupplyChainPromise[];
|
|
22
25
|
sales?: unknown[];
|
|
26
|
+
fee_overrides?: Record<string, number | string>;
|
|
23
27
|
}
|
|
24
28
|
export interface MerchantGuideInput {
|
|
25
29
|
intent?: string;
|
|
@@ -41,7 +45,9 @@ export interface MerchantGuideInput {
|
|
|
41
45
|
affiliate_mode?: string;
|
|
42
46
|
crowdfunding_mode?: string;
|
|
43
47
|
logistics_mode?: string;
|
|
48
|
+
supply_chain?: SupplyChainPromise[];
|
|
44
49
|
sales?: unknown[];
|
|
50
|
+
fee_overrides?: Record<string, number | string>;
|
|
45
51
|
};
|
|
46
52
|
guide_confirm?: {
|
|
47
53
|
industry?: string;
|
|
@@ -60,6 +66,7 @@ export interface MerchantGuideInput {
|
|
|
60
66
|
affiliate_mode?: string;
|
|
61
67
|
crowdfunding_mode?: string;
|
|
62
68
|
logistics_mode?: string;
|
|
69
|
+
supply_chain?: SupplyChainPromise[];
|
|
63
70
|
sales?: unknown[];
|
|
64
71
|
};
|
|
65
72
|
template_override?: IndustryTemplate;
|
|
@@ -82,6 +89,9 @@ interface CreationPlanEntry {
|
|
|
82
89
|
depends_on: string[];
|
|
83
90
|
operation_hint: string;
|
|
84
91
|
}
|
|
92
|
+
export declare const GAS_PER_ORDER_SMALLEST = 6000000;
|
|
93
|
+
export declare const MIN_ECONOMIC_ORDER_SMALLEST = 50000000;
|
|
94
|
+
export declare function gasEconomicsWarnings(sales: unknown[] | undefined, rewardClaimAmount: string | number | undefined): string[];
|
|
85
95
|
export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
86
96
|
action: "merchant_guide";
|
|
87
97
|
current_step: number;
|
|
@@ -96,9 +106,6 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
96
106
|
warnings: string[];
|
|
97
107
|
next_action: string;
|
|
98
108
|
} | {
|
|
99
|
-
warnings: string[];
|
|
100
|
-
next_action: string;
|
|
101
|
-
plan: import("../../composition/plan.js").Plan;
|
|
102
109
|
audit: {
|
|
103
110
|
issues: import("../../composition/plan.js").PlanIssue[];
|
|
104
111
|
findings: import("../../config/rule-engine.js").RuleBookFinding[];
|
|
@@ -110,6 +117,22 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
110
117
|
blocks: import("../../composition/reflux.js").RefluxBlock[];
|
|
111
118
|
iterations: number;
|
|
112
119
|
};
|
|
120
|
+
required_local_marks?: string[] | undefined;
|
|
121
|
+
required_local_marks_note?: string | undefined;
|
|
122
|
+
warnings: string[];
|
|
123
|
+
next_action: string;
|
|
124
|
+
plan: {
|
|
125
|
+
catalog_version: number;
|
|
126
|
+
template_digest?: string;
|
|
127
|
+
version: 1;
|
|
128
|
+
intent: string;
|
|
129
|
+
templateId?: string;
|
|
130
|
+
inputs: Record<string, JsonValue>;
|
|
131
|
+
steps: import("../../composition/plan.js").PlanStep[];
|
|
132
|
+
external_refs?: string[];
|
|
133
|
+
pending_guards?: import("../../composition/plan.js").PendingGuard[];
|
|
134
|
+
derived_params?: import("../../composition/plan.js").DerivedParam[];
|
|
135
|
+
};
|
|
113
136
|
pending_count_note?: string | undefined;
|
|
114
137
|
pending_guard_designs?: {
|
|
115
138
|
how_to_resolve: string;
|
|
@@ -124,11 +147,21 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
124
147
|
}[];
|
|
125
148
|
}[] | undefined;
|
|
126
149
|
key_queries?: string[] | undefined;
|
|
150
|
+
logic_summary_note?: string | undefined;
|
|
127
151
|
logic_summary?: string | undefined;
|
|
128
152
|
key: string;
|
|
129
153
|
template_id: string;
|
|
130
154
|
host: "reward" | "service" | "arbitration" | "machine" | "repository";
|
|
131
155
|
purpose: string;
|
|
156
|
+
bound: boolean;
|
|
157
|
+
}[] | undefined;
|
|
158
|
+
mandatory_disclosures: string[];
|
|
159
|
+
supply_chain?: {
|
|
160
|
+
handoff?: import("../../composition/supply-chain-emit.js").SupplyChainHandoff | undefined;
|
|
161
|
+
steps: string[];
|
|
162
|
+
inputs: Record<string, string>;
|
|
163
|
+
primitives: import("../../chain-semantics/composition-truth.js").PrimitiveId[];
|
|
164
|
+
notes: string[];
|
|
132
165
|
}[] | undefined;
|
|
133
166
|
blueprint: {
|
|
134
167
|
nodes: {
|
|
@@ -153,7 +186,7 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
153
186
|
graph_validation: {
|
|
154
187
|
valid: boolean;
|
|
155
188
|
hard_violations: {
|
|
156
|
-
id: "PLAN_DUP_STEP" | "PLAN_UNKNOWN_KIND" | "PLAN_REF_UNKNOWN" | "PLAN_REF_FORWARD" | "PLAN_PUBLISH_TARGET" | "PLAN_PROSE_GUARD" | "PLAN_MACHINE_NODES" | "PLAN_REQUIRES_UNKNOWN";
|
|
189
|
+
id: "PLAN_DUP_STEP" | "PLAN_UNKNOWN_KIND" | "PLAN_REF_UNKNOWN" | "PLAN_REF_FORWARD" | "PLAN_PUBLISH_TARGET" | "PLAN_PROSE_GUARD" | "PLAN_MACHINE_NODES" | "PLAN_REQUIRES_UNKNOWN" | "PLAN_GUARD_PLACEHOLDER" | "PLAN_GUARD_EMPTY_VEC" | "PLAN_GUARD_ZERO_ADDR" | "PLAN_LOGIC_ARITY" | "PLAN_NAME_COLLISION";
|
|
157
190
|
description: string;
|
|
158
191
|
fix: string;
|
|
159
192
|
}[];
|
|
@@ -164,11 +197,11 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
164
197
|
};
|
|
165
198
|
harness_check: {
|
|
166
199
|
module_constraints: {
|
|
167
|
-
module:
|
|
200
|
+
module: string;
|
|
168
201
|
plan_satisfied: boolean;
|
|
169
202
|
missing: string[] | undefined;
|
|
170
203
|
reason: string | undefined;
|
|
171
|
-
|
|
204
|
+
findings: import("../../extensions/capability.js").CapabilityAdoptionFinding[];
|
|
172
205
|
evidence_matched: boolean | undefined;
|
|
173
206
|
}[];
|
|
174
207
|
blocking_issues: {
|
|
@@ -177,13 +210,13 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
177
210
|
fix: string;
|
|
178
211
|
}[];
|
|
179
212
|
module_gaps: {
|
|
180
|
-
module:
|
|
213
|
+
module: string;
|
|
181
214
|
missing_constraints: string[] | undefined;
|
|
182
215
|
fix: string | undefined;
|
|
183
216
|
}[];
|
|
184
217
|
deploy_time_checks: string[];
|
|
185
218
|
recipient_design_guidance: {
|
|
186
|
-
id: "
|
|
219
|
+
id: "signer" | "entity" | "submitted_object" | "constrained_submission";
|
|
187
220
|
move_recipient: string;
|
|
188
221
|
semantics: string;
|
|
189
222
|
required_constraints: string[];
|
|
@@ -225,11 +258,13 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
225
258
|
creation_plan: CreationPlanEntry[];
|
|
226
259
|
post_deploy_steps: PostDeployStep[];
|
|
227
260
|
time_anchor_instructions?: string[] | undefined;
|
|
261
|
+
user_input_questions?: import("../../knowledge/param-schema.js").UserInputQuestion[] | undefined;
|
|
262
|
+
user_input_note?: string | undefined;
|
|
228
263
|
action: "merchant_guide";
|
|
229
264
|
current_step: number;
|
|
230
265
|
step_name: string;
|
|
231
266
|
guide_state: {
|
|
232
|
-
adopted_module_ids:
|
|
267
|
+
adopted_module_ids: string[];
|
|
233
268
|
intent_text: string;
|
|
234
269
|
confirmed_industry?: string;
|
|
235
270
|
currency?: string;
|
|
@@ -246,7 +281,9 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
246
281
|
affiliate_mode?: "commission" | "none";
|
|
247
282
|
crowdfunding_mode?: "threshold" | "flexible" | "none";
|
|
248
283
|
logistics_mode?: "none" | "carrier" | "merchant_managed" | "courier" | "pickup_point";
|
|
284
|
+
supply_chain?: SupplyChainPromise[];
|
|
249
285
|
sales?: unknown[];
|
|
286
|
+
fee_overrides?: Record<string, number | string>;
|
|
250
287
|
};
|
|
251
288
|
intent: {
|
|
252
289
|
intent_type: import("./intent-analyzer.js").BusinessIntentType;
|
|
@@ -262,7 +299,7 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
262
299
|
trust: TrustIntent;
|
|
263
300
|
};
|
|
264
301
|
adopted_modules: {
|
|
265
|
-
id:
|
|
302
|
+
id: string;
|
|
266
303
|
name: string;
|
|
267
304
|
description: string;
|
|
268
305
|
requires_keeper: boolean;
|
|
@@ -289,7 +326,7 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
289
326
|
purpose: string;
|
|
290
327
|
}[];
|
|
291
328
|
allocator: {
|
|
292
|
-
recipient: "fixed" | "
|
|
329
|
+
recipient: "fixed" | "signer" | "entity";
|
|
293
330
|
count: number;
|
|
294
331
|
mode: "amount" | "surplus" | "rate";
|
|
295
332
|
description: string;
|
|
@@ -298,12 +335,13 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
298
335
|
once_per_order?: boolean | undefined;
|
|
299
336
|
rows?: {
|
|
300
337
|
track: "refund" | "settlement";
|
|
301
|
-
recipient: "
|
|
338
|
+
recipient: "signer" | "entity" | "guard_identifier";
|
|
302
339
|
mode: "amount" | "surplus" | "rate";
|
|
303
340
|
recipient_key?: string | undefined;
|
|
304
341
|
value?: string | number | undefined;
|
|
305
342
|
value_from?: string | undefined;
|
|
306
343
|
value_from_complement?: string | undefined;
|
|
344
|
+
repeat_from?: string | undefined;
|
|
307
345
|
fix?: string | number | undefined;
|
|
308
346
|
fix_from?: string | undefined;
|
|
309
347
|
guard_key?: string | undefined;
|
|
@@ -316,12 +354,4 @@ export declare function handleMerchantGuide(v: MerchantGuideInput): Promise<{
|
|
|
316
354
|
intent_draft?: undefined;
|
|
317
355
|
industry_options?: undefined;
|
|
318
356
|
}>;
|
|
319
|
-
export declare function listBusinessModules(): {
|
|
320
|
-
id: BusinessModuleId;
|
|
321
|
-
name: string;
|
|
322
|
-
description: string;
|
|
323
|
-
industry_fit: Record<string, number>;
|
|
324
|
-
addresses_pain_points: string[];
|
|
325
|
-
requires_keeper: boolean;
|
|
326
|
-
}[];
|
|
327
357
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{analyzeIntent}from'./intent-analyzer.js';import{compileTemplate}from'../../composition/compile.js';import{reflux,auditScore}from'../../composition/reflux.js';import{planBlueprint}from'../../composition/blueprint-view.js';import{getGuardDesignPattern}from'../../knowledge/guard-design-patterns.js';import{GUARD_TEMPLATES,getTemplatesByScene}from'../../knowledge/guard-templates.js';import{checkGameTheoryConstraints}from'./game-theory.js';import{assessWorkflowDesign}from'./workflow-design-assessment.js';import{CORE_BUSINESS_MODULES,getBusinessModule,recommendModules,checkModuleConstraints,moduleHasIntentEvidence}from'../../extensions/business-modules.js';import{recipientDesignGuidance}from'../../knowledge/recipient-constraint.js';import{getTemplate,getTemplatesByIndustry}from'../../knowledge/template-loader.js';import{getScenarioMode}from'../../knowledge/scenario-modes.js';function derivePlanSatisfiedConstraints(a,b){const c=new Set(),d=i=>a['edges']['some'](j=>j['relation']===i),e=i=>a['nodes']['some'](j=>j['id']===i),f=i=>a['nodes']['some'](j=>j['type']===i),g=i=>a['adoptedModules']['includes'](i);if(d('has_order_allocators'))c['add']('order_allocators_bound');if(d('uses_machine'))c['add']('machine_bound_before_publish');if(d('has_arbitration'))c['add']('arbitration_bound_to_service');if(e('machine'))c['add']('machine_published');if(e('repository'))c['add']('repository_published');if(e('service'))c['add']('service_published');e('permission_arb')&&e('permission')&&c['add']('arbitration_permission_independent');g('independent_arbitration')&&a['nodes']['some'](i=>i['id']['includes']('guard')&&i['id']['includes']('arbitration'))&&c['add']('voting_guard_configured');g('accept_timeout_protection')&&(c['add']('time_guard_configured'),c['add']('adminUnhold_permission'));g('milestone_escrow')&&f('guard')&&c['add']('milestone_forward_guarded');const h=d('has_order_allocators');if(h&&b['payment']['allocation']&&b['payment']['allocation']['length']>0x0){c['add']('allocators_configured');const i=b['payment']['allocation']['reduce']((k,l)=>k+l['percentage'],0x0);if(Math['abs'](i-0x64)<0.001)c['add']('sharing_sum_100');const j=b['payment']['allocation']['find'](k=>k['recipient']==='platform');if(!j||j['percentage']===0x0)c['add']('platform_fee_zero');g('supplier_collaboration')&&(c['add']('allocation_sharing_configured'),c['add']('demand_configured'));}g('wip_provenance')&&e('repository')&&c['add']('wip_hash_before_delivery');g('subscription_with_proof')&&e('repository')&&(c['add']('delivery_guard_per_cycle'),c['add']('repository_updated'));g('damage_attestation')&&(c['add']('pre_rental_hash'),c['add']('post_rental_hash'));g('refund_guarantee')&&(c['add']('compensation_fund_positive'),c['add']('refund_guard_configured'));if(g('praise_incentive')){const k=a['plan']['steps']['some'](m=>m['op']==='create'&&m['object']==='reward'),l=a['plan']['steps']['some'](m=>m['op']==='configure'&&m['method']==='coin_add');k&&l&&(c['add']('reward_pool_funded'),c['add']('reward_claim_replay_armed'));}g('discount_lifecycle')&&(c['add']('discount_budget_planned'),c['add']('discount_burn_disclosed'));if(g('after_sales_guarantee')){const m=a['plan']['steps']['find'](p=>p['op']==='create'&&p['object']==='machine'),n=m?.['params']?.['nodes']??[],o=n['some'](p=>/return|refund|exchange|replace|reship|swap|warranty|repair/i['test'](p['name']??''));o&&(c['add']('after_sales_rail_present'),c['add']('after_sales_polarity_pair'),c['add']('after_sales_window_anchored'),c['add']('after_sales_no_double_remedy'));}if(g('acceptance_judging')){const p=a['plan']['steps']['find'](t=>t['op']==='create'&&t['object']==='machine'),q=p?.['params']?.['nodes']??[],r=q['map'](t=>t['name']??''),s=r['some'](t=>/accept|approv|award|ruling|place|placement|triage|vot|evaluat|winner|judge/i['test'](t));if(s){const t=r['some'](u=>/revis|redeliver|resubmit|rework/i['test'](u));c['add']('acceptance_race_free');if(e('arbitration'))c['add']('acceptance_judge_independent');if(!t||e('repository'))c['add']('acceptance_revision_bounded');}}if(g('installment_deposit')){const u=a['plan']['steps']['find'](z=>z['op']==='create'&&z['object']==='machine'),v=u?.['params']?.['nodes']??[],w=v['map'](z=>z['name']??''),x=w['some'](z=>/(deposit|down_?pay|balance_due|balance_owed|installment|milestone|awaiting|owed)/i['test'](z)),y=w['some'](z=>/(paid|funded|captured|settled)/i['test'](z));x&&y&&(c['add']('installment_funding_gated'),c['add']('installment_deposit_exit'),c['add']('installment_release_once'));}if(g('affiliate_commission')){const z=a['plan']['steps']['find'](D=>D['op']==='create'&&D['object']==='machine'),A=z?.['params']?.['nodes']??[],B=A['map'](D=>D['name']??''),C=B['some'](D=>/(commission|affiliate|referr|attribut|partner_?payout)/i['test'](D));C&&(c['add']('affiliate_rail_present'),c['add']('affiliate_clawback_disclosed'),c['add']('affiliate_window_anchored'));}if(g('crowdfunding')){const D=a['plan']['steps']['find'](H=>H['op']==='create'&&H['object']==='machine'),E=D?.['params']?.['nodes']??[],F=E['map'](H=>H['name']??''),G=F['some'](H=>/(releas|settle|funded|disburs|project)/i['test'](H));G&&(c['add']('crowdfunding_exit_rail_present'),c['add']('crowdfunding_aggregate_writer_bound'),c['add']('crowdfunding_disclosure_present'));}if(g('logistics_fulfillment')){const H=a['plan']['steps']['find'](L=>L['op']==='create'&&L['object']==='machine'),I=H?.['params']?.['nodes']??[],J=I['map'](L=>L['name']??''),K=J['some'](L=>/(dispatch|handover|hand_over|pickup|deliver|courier|rider|shipped)/i['test'](L));K&&(c['add']('logistics_rail_present'),c['add']('logistics_loss_covered'),c['add']('logistics_fee_independent'),c['add']('logistics_dispatch_disclosed'));}return c;}function deriveDeployTimeChecks(a,b=![]){const c=[];return a['nodes']['some'](d=>d['id']==='machine')&&c['push']('Machine\x20published\x20AND\x20bound\x20to\x20Service\x20BEFORE\x20Service.publish\x20(machine\x20is\x20immutable\x20after\x20publish)'),a['edges']['some'](d=>d['relation']==='has_order_allocators')&&(c['push']('Service.order_allocators\x20bound\x20(verify\x20via\x20query_objects\x20after\x20publish\x20—\x20order_allocators\x20is\x20FROZEN\x20at\x20publish)'),c['push']('Settlement\x20is\x20NOT\x20triggered\x20by\x20reaching\x20a\x20Machine\x20node\x20alone\x20—\x20an\x20explicit\x20alloc_by_guard\x20call\x20(keeper\x20or\x20merchant)\x20fires\x20the\x20settlement\x20Allocator\x20once\x20its\x20Guard\x20passes.\x20Declare\x20the\x20node->allocator\x20trigger\x20(which\x20terminal\x20node\x20unlocks\x20settlement)\x20and\x20schedule\x20the\x20keeper\x20step;\x20otherwise\x20orders\x20stall\x20at\x20the\x20settle\x20node\x20with\x20allocation_state=pending')),(a['adoptedModules']['includes']('refund_guarantee')||a['nodes']['some'](d=>d['id']==='arbitration'))&&(b?c['push']('COMPENSATION\x20FUND:\x20DO\x20NOT\x20FUND\x20—\x20this\x20template\x20declares\x20compensation_fund_policy=forbidden\x20(the\x20unreserved\x20pool\x20is\x20double-takeable\x20via\x20refund-then-claim\x20until\x20the\x20arbitration-escrow\x20shared\x20gate\x20lands;\x20user\x20ruling\x202026-10-15).\x20Disputes\x20ride\x20the\x20escrow\x20rails\x20only;\x20the\x20compensation_fund_topup\x20post-deploy\x20step\x20is\x20intentionally\x20absent'):c['push']('compensation_fund\x20MUST\x20be\x20able\x20to\x20cover\x20payouts:\x20a\x20claim\x20against\x20a\x20drained\x20fund\x20aborts\x20(service.move\x20E_COMPENSATION_NOT_MATCH).\x20Size\x20the\x20fund\x20>=\x203x\x20a\x20TYPICAL\x20single\x20order\x20(3x\x20IS\x20the\x20chain\x27s\x20hard\x20award\x20ceiling,\x20MAX_INDEMNITY_MULTIPLE)\x20—\x20per-order\x20coverage\x20is\x20enforced\x20at\x20BUY\x20time\x20(each\x20order\x20is\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount,\x20not\x203x\x20the\x20highest\x20SKU),\x20so\x20publish\x20no\x20longer\x20blocks\x20on\x20coverage;\x20verify\x20the\x20on-chain\x20balance\x20before\x20going\x20live.\x205R-07③:\x20after\x20go-live\x20the\x20keeper\x20WATCHES\x20the\x20water\x20level\x20(see\x20the\x20compensation_fund_watch\x20step)\x20—\x20no\x20hard\x20gate,\x20the\x20merchant\x20decides')),a['nodes']['some'](d=>d['id']==='arbitration')&&(c['push']('Arbitration.permission\x20!=\x20Service.permission\x20on-chain\x20(E_ARBITRATION_PERMISSION_CONFLICT=33)'),c['push']('A\x20freshly\x20created\x20Arbitration\x20defaults\x20to\x20PAUSED\x20—\x20unpause\x20it\x20(arbitration\x20activation)\x20before\x20the\x20first\x20case\x20can\x20be\x20filed,\x20otherwise\x20dispute\x20filing\x20aborts'),c['push']('ARBITRATION\x20VENUE\x20OWNERSHIP\x20(D-5):\x20the\x20recommended\x20onboarding\x20default\x20is\x20a\x20SELF-BUILT\x20venue\x20—\x20your\x20own\x20Arbitration\x20object\x20with\x20your\x20own\x20permission/admin\x20(voting_guard\x20tpl_voting_guard_open_vote\x20for\x20community\x20cases,\x20tpl_voting_guard_numeric_weight\x20for\x20a\x20named\x20panel).\x20A\x20THIRD-PARTY\x20venue\x20you\x20do\x20not\x20control\x20hands\x20the\x20private\x20key\x20that\x20answers\x20and\x20appeals\x20cases\x20to\x20its\x20operator:\x20an\x20outside\x20store\x27s\x20admin\x20going\x20silent\x20strands\x20your\x20defense\x20(F-16,\x20live-proven).\x20Use\x20an\x20outside\x20venue\x20ONLY\x20when\x20its\x20operator\x20is\x20a\x20named,\x20reachable\x20counterparty\x20the\x20merchant\x20accepts')),a['nodes']['some'](d=>d['id']==='repository')&&c['push']('Repository\x20published\x20and\x20Guard\x20write\x20validation\x20configured'),c['push']('After\x20materialization,\x20confirm\x20the\x20on-chain\x20state\x20matches\x20this\x20plan\x20(query_toolkit\x20query_type=\x27service_panorama\x27)'),c;}function derivePostDeploySteps(a,b=![]){const c=[];return!b&&(a['adoptedModules']['includes']('refund_guarantee')||a['nodes']['some'](d=>d['id']==='arbitration'))&&(c['push']({'order':c['length']+0x1,'id':'compensation_fund_topup','title':'Top\x20up\x20the\x20compensation\x20fund','when':'After\x20the\x20Service\x20object\x20is\x20created,\x20BEFORE\x20the\x20service\x20goes\x20live\x20(before\x20the\x20first\x20order)','action':'Call\x20compensation_fund_add\x20sized\x20>=\x203x\x20a\x20TYPICAL\x20single\x20order\x20(3x\x20=\x20the\x20chain\x27s\x20hard\x20award\x20ceiling,\x20MAX_INDEMNITY_MULTIPLE;\x20above\x203x\x20only\x20buys\x20headroom\x20for\x20concurrent\x20claims).\x20Per-order\x20coverage\x20is\x20enforced\x20at\x20BUY\x20time\x20—\x20each\x20incoming\x20order\x20is\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount\x20and\x20under-covered\x20orders\x20cannot\x20be\x20created\x20—\x20then\x20verify\x20the\x20on-chain\x20fund\x20balance\x20via\x20query_objects','tool_hint':'onchain_operations\x20(service.compensation_fund_add)','failure_if_skipped':'a\x20compensation\x20claim\x20against\x20an\x20empty\x20fund\x20aborts\x20(E_COMPENSATION_NOT_MATCH,\x20testnet\x20lesson\x20R-4)'}),c['push']({'order':c['length']+0x1,'id':'compensation_fund_watch','title':'Watch\x20the\x20compensation-fund\x20water\x20level\x20(recurring\x20keeper\x20step)','when':'Recurring\x20—\x20on\x20every\x20keeper\x20cycle\x20after\x20go-live,\x20and\x20ALWAYS\x20immediately\x20after\x20each\x20arbitration\x20payout\x20posts','action':'Query\x20the\x20on-chain\x20fund\x20balance\x20and\x20classify\x20it\x20with\x20classifyFundWaterLevel(balance,\x20low_water_threshold)\x20into\x20THREE\x20tiers:\x20HEALTHY\x20(balance\x20>=\x20threshold\x20—\x20silence\x20is\x20the\x20healthy\x20signal,\x20no\x20event)\x20/\x20LOW\x20WATER\x20(0\x20<\x20balance\x20<\x20threshold\x20—\x20surface\x20fundWaterReminder:\x20recommend\x20topping\x20up\x20via\x20compensation_fund_add;\x20one\x20large\x20award\x20could\x20make\x20a\x20flagship\x20SKU\x20unbuyable,\x20F-46)\x20/\x20DEPLETED\x20(balance\x200\x20—\x20surface\x20fundWaterReminder\x20LOUD:\x20every\x20claim\x20aborts\x2027\x20and\x20under-covered\x20SKUs\x20are\x20unbuyable).\x20Thresholds\x20are\x20the\x20MERCHANT\x27s\x20call\x20(decision\x207)\x20—\x20recommended\x20anchor:\x20low-water\x20line\x20at\x203x\x20the\x20flagship\x20SKU\x20price\x20(below\x20it\x20the\x20flagship\x20can\x20no\x20longer\x20be\x20bought),\x20healthy\x20line\x20at\x203x\x20the\x20typical\x20order.\x20NEVER\x20block\x20a\x20SKU\x20or\x20gate\x20a\x20claim\x20on\x20the\x20tier\x20—\x20the\x20reminder\x20is\x20the\x20whole\x20feature;\x20the\x20merchant\x20decides\x20(top\x20up\x20/\x20accept\x20the\x20exposure)','tool_hint':'query_toolkit\x20(service_panorama:\x20fund\x20balance)\x20+\x20knowledge/fund-layer\x20classifyFundWaterLevel\x20+\x20onchain_operations\x20(service.compensation_fund_add)\x20on\x20the\x20merchant\x27s\x20decision','failure_if_skipped':'a\x20drained\x20or\x20low\x20fund\x20is\x20SILENT\x20—\x20the\x20first\x20signal\x20is\x20a\x20buyer\x27s\x20claim\x20aborting\x20(27)\x20or\x20a\x20flagship\x20SKU\x20failing\x20to\x20sell\x20(buy-time\x203x\x20coverage\x20refusal,\x20F-46)'})),a['nodes']['some'](d=>d['id']==='arbitration')&&(c['push']({'order':c['length']+0x1,'id':'arbitration_unpause','title':'Activate\x20the\x20Arbitration\x20(unpause)','when':'Immediately\x20after\x20the\x20Arbitration\x20object\x20is\x20created,\x20before\x20the\x20first\x20dispute\x20is\x20filed','action':'Unpause/activate\x20the\x20Arbitration\x20so\x20dispute\x20filing\x20is\x20accepted;\x20keep\x20its\x20Permission\x20distinct\x20from\x20the\x20Service\x20Permission\x20(E_ARBITRATION_PERMISSION_CONFLICT=33)','tool_hint':'onchain_operations\x20(arbitration\x20activation)','failure_if_skipped':'a\x20freshly\x20created\x20Arbitration\x20defaults\x20to\x20PAUSED\x20—\x20dispute\x20filing\x20aborts\x20(testnet\x20lesson\x20R-5)'}),c['push']({'order':c['length']+0x1,'id':'voting_guard_open_vote','title':'Bind\x20the\x20open-vote\x20voting_guard\x20(tpl_voting_guard_open_vote)','when':'After\x20the\x20Arbitration\x20is\x20activated,\x20BEFORE\x20the\x20first\x20dispute\x20can\x20be\x20voted\x20on','action':'Create\x20the\x20open-vote\x20guard\x20(tpl_voting_guard_open_vote:\x20always-true\x20root\x20+\x20FixedValue\x20weight\x201\x20=\x20one\x20person\x20one\x20vote)\x20and\x20set\x20it\x20as\x20the\x20Arbitration\x27s\x20voting_guard;\x20skip\x20this\x20step\x20ONLY\x20for\x20a\x20deliberately\x20closed\x20panel\x20(then\x20bind\x20tpl_voting_guard_numeric_weight\x20with\x20the\x20arbitrator\x20address\x20list\x20instead)','tool_hint':'onchain_operations\x20(guard\x20creation\x20+\x20arbitration\x20voting_guard\x20set,\x20op=\x27set\x27)','failure_if_skipped':'an\x20EMPTY\x20voting_guard\x20dead-locks\x20every\x20plain\x20vote\x20on\x20permission\x20358\x20(creator-admin\x20only)\x20—\x20the\x20first\x20dispute\x20cannot\x20reach\x20a\x20verdict\x20if\x20the\x20admin\x20is\x20unresponsive\x20(crs9-F-36,\x20R-ARB-VOTE-LOCK)'})),a['edges']['some'](d=>d['relation']==='has_order_allocators')&&c['push']({'order':c['length']+0x1,'id':'settlement_alloc_by_guard','title':'Fire\x20settlement\x20via\x20alloc_by_guard\x20(keeper/merchant\x20step)','when':'Recurring\x20—\x20after\x20EACH\x20order\x20reaches\x20its\x20settlement\x20terminal\x20node\x20(declare\x20which\x20node\x20unlocks\x20settlement)','action':'Call\x20alloc_by_guard\x20on\x20the\x20order\x27s\x20allocation\x20with\x20the\x20settlement\x20Guard;\x20reaching\x20the\x20Machine\x20node\x20alone\x20does\x20NOT\x20settle\x20(allocation_state\x20stays\x20pending)','tool_hint':'onchain_operations\x20(allocation.alloc_by_guard);\x20schedule\x20as\x20a\x20keeper\x20step','failure_if_skipped':'orders\x20stall\x20at\x20the\x20settle\x20node\x20with\x20funds\x20locked\x20in\x20escrow\x20(testnet\x20lesson\x20R-2)'}),c['push']({'order':c['length']+0x1,'id':'verify_service_panorama','title':'Verify\x20the\x20on-chain\x20state\x20matches\x20the\x20plan','when':'After\x20all\x20creation\x20steps\x20and\x20the\x20steps\x20above\x20are\x20done','action':'Run\x20the\x20service\x20panorama\x20query\x20and\x20diff\x20it\x20against\x20this\x20plan\x27s\x20blueprint/creation_plan','tool_hint':'query_toolkit\x20query_type=\x27service_panorama\x27','failure_if_skipped':'plan/chain\x20drift\x20(missing\x20binding,\x20wrong\x20allocator\x20order)\x20stays\x20undetected\x20until\x20an\x20order\x20hits\x20it'}),c;}function buildCreationPlan(a){const b=[],c=new Map(a['nodes']['map'](k=>[k['id'],k])),f=new Map();for(const k of a['nodes'])f['set'](k['id'],new Set());for(const l of a['edges']){if(!f['has'](l['from'])||!c['has'](l['to']))continue;const m=l['relation']==='has_guard'?l['to']:l['from'],o=l['relation']==='has_guard'?l['from']:l['to'];if(m===o||!f['has'](m))continue;f['get'](m)['add'](o);}for(const p of a['nodes']){for(const q of Object['values'](p['config'])){q['type']==='address_ref'&&q['targetId']!==p['id']&&f['has'](q['targetId'])&&f['get'](p['id'])['add'](q['targetId']);}}const g=a['nodes']['filter'](r=>r['type']==='service')['map'](r=>r['id']);if(g['length']>0x0)for(const r of a['nodes']){if(r['type']!=='guard')continue;const s=f['get'](r['id']);if(s===undefined)continue;for(const t of g)s['add'](t);}const h=new Map([...f]['map'](([u,v])=>[u,[...v]])),i=[],j=new Map(f);while(j['size']>0x0){const u=[...j['entries']()]['filter'](([,v])=>v['size']===0x0)['map'](([v])=>v);if(u['length']===0x0){i['push'](...j['keys']());break;}u['sort']();for(const v of u){i['push'](v),j['delete'](v);for(const w of j['values']())w['delete'](v);}}return i['forEach']((x,y)=>{const z=c['get'](x),A=z['config']['name'],B=A?.['type']==='string'?A['value']:x,C=B['includes']('/')?B['replaceAll']('/','__'):B;b['push']({'order':y+0x1,'node_id':x,'object_type':z['type'],'suggested_name':C,'depends_on':h['get'](x)??[],'operation_hint':'Create\x20'+z['type']+'\x20via\x20onchain_operations,\x20then\x20configure.\x20Purpose:\x20'+z['purpose']});}),b;}function resolveTemplate(a,b){if(!a)return undefined;const c=getTemplate(a);if(c)return c;const d=getTemplatesByIndustry(a);if(b){const f=b['toLowerCase'](),g=d['filter'](h=>{const i=String(h['product_ref']??'')['trim']()['toLowerCase']();return i['length']>0x0&&f['includes'](i);});if(g['length']===0x1)return g[0x0];}const e=getScenarioMode(a)?.['default_template'];if(e){const h=getTemplate(e);if(h)return h;}if(d['length']>0x0)return d[0x0];return undefined;}export async function handleMerchantGuide(a){const b=a['guide_state']??{'intent_text':''},c=a['guide_confirm']??{},d={'intent_text':(a['intent']??b['intent_text']??'')['trim'](),'confirmed_industry':c['industry']??b['confirmed_industry'],'currency':c['currency']??b['currency'],'deliverables':c['deliverables']??b['deliverables'],'payment_override':c['payment']??b['payment_override'],'trust_override':c['trust']??b['trust_override'],'adopted_module_ids':c['adopted_module_ids']??b['adopted_module_ids'],'guard_resolutions':{...b['guard_resolutions']??{},...c['guard_resolutions']??{}},'review_mode':c['review_mode']??b['review_mode'],'reward_funding':c['reward_funding']??b['reward_funding'],'reward_claim_amount':c['reward_claim_amount']??b['reward_claim_amount'],'after_sales_mode':c['after_sales_mode']??b['after_sales_mode'],'acceptance_mode':c['acceptance_mode']??b['acceptance_mode'],'installment_mode':c['installment_mode']??b['installment_mode'],'affiliate_mode':c['affiliate_mode']??b['affiliate_mode'],'crowdfunding_mode':c['crowdfunding_mode']??b['crowdfunding_mode'],'logistics_mode':c['logistics_mode']??b['logistics_mode'],'sales':c['sales']??b['sales']};for(const O of Object['keys'](d)){if(d[O]===undefined)delete d[O];}if(d['guard_resolutions']&&Object['keys'](d['guard_resolutions'])['length']===0x0)delete d['guard_resolutions'];if(!d['intent_text'])throw new Error('merchant_guide\x20requires\x20\x27intent\x27\x20(business\x20description)\x20for\x20Step\x201.\x20'+'Example:\x20intent=\x27I\x20want\x20to\x20offer\x20online\x20design\x20service\x20with\x20milestone\x20payments\x27.\x20'+'Pass\x20the\x20returned\x20guide_state\x20back\x20UNCHANGED\x20on\x20subsequent\x20calls,\x20plus\x20guide_confirm\x20for\x20merchant\x20decisions.');const e=await analyzeIntent(d['intent_text'],{'preferredIndustry':d['confirmed_industry'],'currency':d['currency']});if(!d['confirmed_industry'])return{'action':'merchant_guide','current_step':0x2,'step_name':'Industry\x20Matching','guide_state':d,'intent_draft':e['intent'],'industry_options':{'inferred':e['inferredIndustry'],'confidence':e['industryConfidence'],'similar':e['similarIndustries']},'warnings':e['warnings'],'next_action':'Confirm\x20the\x20industry\x20by\x20calling\x20merchant_guide\x20again\x20with\x20guide_state\x20(UNCHANGED)\x20'+('plus\x20guide_confirm={\x20industry:\x20\x27<one\x20of:\x20'+e['similarIndustries']['join'](',\x20')+'\x20—\x20or\x20any\x20other\x20industry\x20id>\x27\x20}')};const f={...e['intent'],'industry':d['confirmed_industry'],'deliverables':d['deliverables']??e['intent']['deliverables'],'payment':{...e['intent']['payment'],...d['payment_override']??{}},'trust':{...e['intent']['trust'],...d['trust_override']??{}}},h=!!d['adopted_module_ids'],i=d['adopted_module_ids']?d['adopted_module_ids']['map'](P=>getBusinessModule(P))['filter'](P=>!!P):recommendModules(d['confirmed_industry'],d['intent_text'],{'maxModules':0x5}),j=a['template_override']??resolveTemplate(d['confirmed_industry'],d['intent_text']);if(!j)throw new Error('No\x20compilable\x20template\x20found\x20for\x20industry\x20\x27'+d['confirmed_industry']+'\x27.\x20'+'Register\x20a\x20template\x20via\x20industry_pack_operation\x20or\x20pass\x20template_override\x20explicitly.');const l={'currency':d['currency']??f['payment']['currency'],...d['payment_override']?{'payment':d['payment_override']}:{},...d['trust_override']?{'trust':d['trust_override']}:{},...d['deliverables']?{'deliverables':d['deliverables']}:{},...d['adopted_module_ids']?{'adopted_module_ids':d['adopted_module_ids']}:{},...d['review_mode']?{'review_mode':d['review_mode']}:{},...d['reward_funding']!==undefined?{'reward_funding':d['reward_funding']}:{},...d['reward_claim_amount']!==undefined?{'reward_claim_amount':d['reward_claim_amount']}:{},...d['after_sales_mode']?{'after_sales_mode':d['after_sales_mode']}:{},...d['acceptance_mode']?{'acceptance_mode':d['acceptance_mode']}:{},...d['installment_mode']?{'installment_mode':d['installment_mode']}:{},...d['affiliate_mode']?{'affiliate_mode':d['affiliate_mode']}:{},...d['crowdfunding_mode']?{'crowdfunding_mode':d['crowdfunding_mode']}:{},...d['logistics_mode']?{'logistics_mode':d['logistics_mode']}:{},...d['sales']?.['length']?{'sales':d['sales']}:{}},m={};for(const P of i){for(const Q of P['templateRefs']){if(Q['object_type']!=='guard')continue;const R=j['guards']['filter'](S=>S['template_id']===Q['template_id']);if(R['length']===0x0)continue;for(const S of R){m[S['key']??Q['template_id']+'#'+j['guards']['indexOf'](S)]={'kind':'template','template_id':Q['template_id']};}}}Object['assign'](m,d['guard_resolutions']??{});const n=compileTemplate(j,l,{'nameBase':a['name_base']??j['id'],'intent':d['intent_text'],'guardResolutions':m}),o=reflux(n['plan']),p=o['plan'],q=o['audit'],r=auditScore(q),s=planBlueprint(p,f,i['map'](T=>T['id'])),t=n['blockers']['map'](T=>({'module':'template','missing_constraints':[T['code']],'fix':T['detail']})),u=derivePlanSatisfiedConstraints(s,f),w=i['map'](T=>checkModuleConstraints(T,u,{'evidenceMatched':h||moduleHasIntentEvidence(T,d['intent_text'])})),x=j['compensation_fund_policy']==='forbidden',y=deriveDeployTimeChecks(s,x),z=derivePostDeploySteps(s,x),A=s['edges']['some'](T=>T['relation']==='has_order_allocators')?recipientDesignGuidance()['map'](T=>({'id':T['id'],'move_recipient':T['move_recipient'],'semantics':T['semantics'],'required_constraints':T['required_constraints'],'finding_if_unmet':T['finding_if_unmet']})):undefined,B=[...w['filter'](T=>!T['adopted']),...t],C=q['findings']['filter'](T=>T['level']==='critical'||T['level']==='high')['map'](T=>({'module':'audit','missing_constraints':[T['rule_id']],'fix':T['title']+'\x20—\x20'+(T['mitigation']??T['description'])})),D=[{'re':/allocat|refund|recover|claimed_by|settle|escrow/i,'scene':'service_order_allocators_guard'},{'re':/\bbuy\b|purchase|allowlist|blocklist/i,'scene':'service_buy_guard'},{'re':/reward/i,'scene':'reward_claim'},{'re':/write_guard|repository_write/i,'scene':'repository_write_guard'},{'re':/arbitrat|ruling|voting/i,'scene':'arbitration_usage_guard'},{'re':/forward|node|witness|deliver|review|cancel|expire|submission|progress/i,'scene':'machine_forward_guard'}],E=[{'re':/claimed_by\s*some\s*==\s*true/i,'tpl':'tpl_allocator_node_gate_recover'},{'re':/claimed_by\s*some\s*==\s*false|claimed_by\s*(?:is\s+)?none|\brefund|\bcancel/i,'tpl':'tpl_allocator_node_gate_refund'},{'re':/claimed_by\s*some|\brecover|\baward/i,'tpl':'tpl_allocator_node_gate_recover'}],F=[{'host':'machine','re':/pattern\.time_lock_progress/i,'tpl':'tpl_time_lock_progress'},{'host':'machine','re':/pattern\.time_window_upper_bound/i,'tpl':'tpl_time_window_upper'},{'host':'reward','re':/pattern\./i,'tpl':'tpl_reward_one_time_claim'}],G=(T,U,V,W,X)=>{let Y;const Z=/tpl_[a-z0-9_]+/['exec'](T+'\x20'+U);Z!==null&&(Y=GUARD_TEMPLATES['find'](a4=>a4['id']===Z[0x0])?.['scene_id']);Y===undefined&&W!=='reward'&&/\ballocators?\b|claimed_by|guard_identifier|order_allocators/i['test'](U)&&(Y='service_order_allocators_guard');if(Y===undefined){if(W==='machine'||W==='machine_forward')Y='machine_forward_guard';else{if(W==='reward')Y='reward_claim';else{if(W==='repository')Y='repository_write_guard';else{if(W==='arbitration')Y='arbitration_usage_guard';else{const a4=D['find'](a5=>a5['re']['test'](T+'\x20'+U));Y=a4?.['scene'];}}}}}if(Y===undefined)return undefined;const a0=getTemplatesByScene(Y);let a1=V!==undefined&&a0['some'](a5=>a5['applicable_industries']['includes'](V))?a0['filter'](a5=>a5['applicable_industries']['includes'](V)):a0;if(/\btime[_-]?lock|\bwindow|\btimeout|\bduration|\bdeadline|\bdays?\b|\bclock|\bdelay/i['test'](T+'\x20'+U)){const a5=a1['filter'](a6=>JSON['stringify'](a6['example_root']??{})['toLowerCase']()['includes']('clock'));if(a5['length']===0x0)return undefined;a1=a5;}if(X['length']>0x0){const a6=Z!==null?a1['find'](a8=>a8['id']===Z[0x0]):undefined,a7=a1['filter'](a8=>{const a9=[];if(a8['example_root']!==undefined){const aa=JSON['stringify'](a8['example_root']);for(const ab of aa['matchAll'](/"query":"([^"]+)"/g))a9['push'](ab[0x1]);if(aa['includes']('\x22type\x22:\x22query_progress_history_time\x22'))a9['push']('progress.history.time');if(aa['includes']('\x22type\x22:\x22query_progress_history_find\x22'))a9['push']('progress.history.find');}return a9['some'](ac=>X['some'](ad=>ac===ad||ac['startsWith'](ad)||ad['startsWith'](ac)));});if(a6!==undefined&&!a7['includes'](a6))a7['push'](a6);if(a7['length']===0x0)return undefined;a1=a7;}const a2=W==='machine_forward'?'machine':W,a3=F['find'](a8=>a8['host']===a2&&a8['re']['test'](T+'\x20'+U)&&a1['some'](a9=>a9['id']===a8['tpl']));a3!==undefined&&(a1=[...a1]['sort']((a8,a9)=>(a8['id']===a3['tpl']?0x0:0x1)-(a9['id']===a3['tpl']?0x0:0x1)));if(Y==='service_order_allocators_guard'){const a8=E['find'](a9=>a9['re']['test'](T+'\x20'+U));a8!==undefined&&(a1=[...a1]['sort']((a9,aa)=>(a9['id']===a8['tpl']?0x0:0x1)-(aa['id']===a8['tpl']?0x0:0x1)));}return a1['slice'](0x0,0x3)['map'](a9=>({'template_id':a9['id'],'name':a9['name'],'parameters':a9['parameters']['map'](aa=>({'name':aa['name'],'required':aa['required'],...aa['default']!==undefined?{'default':aa['default']}:{},'description':aa['description']}))}));},H=n['unresolved']['map'](T=>{const U=getGuardDesignPattern(T['template_id']),V=G(T['template_id'],T['purpose'],j?.['industry'],T['host'],U?.['key_queries']??[]),W=new Set((j?.['machine_shape']??[])['flatMap'](a1=>(a1['from']??[])['map'](a2=>typeof a2==='string'?undefined:a2['guard_key'])['filter'](a2=>typeof a2==='string'))),X=new Map((j?.['allocator']['rows']??[])['filter'](a1=>typeof a1['guard_key']==='string')['map'](a1=>[a1['guard_key'],a1])),Y=X['get'](T['key']),Z=Y!==undefined&&!W['has'](T['key']),a0=!W['has'](T['key'])&&!X['has'](T['key'])&&T['policy']===undefined&&T['host']!=='reward'&&!(T['host']==='service'&&T['key']==='buy');return{'key':T['key'],'template_id':T['template_id'],'host':T['host'],'purpose':T['purpose'],...U?.['logic_summary']?{'logic_summary':U['logic_summary']}:{},...U?.['key_queries']?.['length']?{'key_queries':U['key_queries']}:{},...V!==undefined&&V['length']>0x0?{'suggested_templates':V}:{},'how_to_resolve':'guide_confirm.guard_resolutions[\x27'+T['key']+'\x27]\x20=\x20{\x20kind:\x20\x27inline\x27,\x20table,\x20root\x20}\x20(a\x20resolved\x20Guard),\x20'+'or\x20{\x20kind:\x20\x27template\x27,\x20template_id:\x20\x27tpl_*\x27,\x20params\x20}\x20when\x20a\x20guard\x20template\x20matches\x20this\x20design'+(V!==undefined&&V['length']>0x0?'\x20(suggested_templates\x20below\x20list\x20the\x20matching\x20executable\x20forms\x20and\x20their\x20parameters)':'.')+(T['host']==='machine'&&!Z?'\x20MACHINE-HOST\x20REQUIREMENT:\x20the\x20inline\x20table\x20MUST\x20declare\x20the\x20protocol\x20task-binding\x20slot\x20'+'{\x20identifier:\x20254,\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22\x20}\x20—\x20the\x20forward\x27s\x20passport\x20only\x20emits\x20'+'DECLARED\x20slots,\x20so\x20a\x20machine-forward\x20guard\x20without\x20this\x20row\x20aborts\x20EVERY\x20order-bound\x20forward\x20'+'it\x20gates\x20(code\x2011)\x20and\x20the\x20pre-publish\x20gate\x20blocks\x20the\x20Machine\x20publish.':'')+(Z?'\x20ALLOCATOR-RAIL\x20NOTE:\x20this\x20design\x20gates\x20an\x20allocator\x20rail\x20(not\x20a\x20machine\x20forward)\x20—\x20do\x20NOT\x20add\x20the\x20'+'254\x20task-binding\x20slot:\x20a\x20254\x20declaration\x20arms\x20once-per-order\x20replay\x20protection\x20at\x20alloc\x20time\x20'+'(allocation\x20ONCE_FOR_OBJECT)\x20and\x20permanently\x20blocks\x20multi-fire\x20rails\x20(a\x20second\x20release\x20aborts\x20'+'E_ONCE_TRIGGERED).\x20The\x20kernel\x20injects\x20254\x20ONLY\x20for\x20GuardIdentifier(254)-recipient\x20rails.'+(Y['recipient']==='guard_identifier'&&Y['recipient_key']!=='254'?'\x20This\x20rail\x27s\x20recipient\x20is\x20GuardIdentifier('+(Y['recipient_key']??'0')+')\x20—\x20the\x20inline\x20table\x20MUST\x20'+('declare\x20slot\x20'+(Y['recipient_key']??'0')+'\x20as\x20an\x20Address\x20submission\x20instead\x20(N-K21:\x20the\x20passport\x20')+'submits\x20the\x20ORDER\x20address\x20into\x20it;\x20an\x20undeclared\x20slot\x20makes\x20the\x20rail\x20unexecutable).':''):'')+(a0?'\x20ADVISORY\x20DESIGN\x20(run75747\x20F-38):\x20nothing\x20in\x20this\x20archetype\x20binds\x20this\x20key\x20—\x20no\x20machine\x20edge,\x20allocator\x20'+'rail,\x20repository\x20policy,\x20or\x20service\x20mount.\x20If\x20this\x20design\x20does\x20not\x20apply\x20to\x20your\x20shop\x20you\x20may\x20resolve\x20'+'it\x20with\x20{\x20kind:\x20\x27omit\x27\x20}\x20instead\x20of\x20building\x20a\x20Guard\x20no\x20one\x20consumes:\x20the\x20design\x20leaves\x20'+'pending_guard_designs,\x20no\x20Guard\x20object\x20is\x20created,\x20and\x20the\x20decision\x20is\x20recorded\x20in\x20the\x20build\x27s\x20'+'warnings.\x20An\x20omit\x20of\x20a\x20BOUND\x20design\x20is\x20refused\x20(GUARD_OMIT_UNSUPPORTED).':'')};}),I=B['length']>0x0||q['blocking'],J={'expiredTerminal':(j['machine_shape']??[])['some'](T=>/expire|deadline|timeout/i['test'](String(T?.['name']??'')))},K=checkGameTheoryConstraints(s,f,J),L=assessWorkflowDesign(s),M=buildCreationPlan(s),N=j?{'name':j['id'],'display_name':j['variant']+'\x20archetype\x20('+j['industry']+')','source':a['template_override']?'custom':'builtin','risk_appetite':'medium','key_risk':j['key_risk'],'machine_shape':j['machine_shape']['map'](T=>({'name':T['name'],'role':T['role'],...T['operator']?{'operator':T['operator']}:{},...T['semantic_role']?{'semantic_role':T['semantic_role']}:{}})),'guards':j['guards']['map'](T=>({'template_id':T['template_id'],'host':T['host'],'purpose':T['purpose']})),'allocator':j['allocator'],'risk_constraints':{},'build_notes':j['build_notes']??[],...j['time_anchors']?{'time_anchors':j['time_anchors']}:{}}:undefined;return{'action':'merchant_guide','current_step':I?0x9:0xa,'step_name':I?'Harness\x20Check\x20(issues\x20found)':'Submission\x20Plan\x20Ready','guide_state':{...d,'adopted_module_ids':i['map'](T=>T['id'])},'intent':{'intent_type':f['intent'],'industry':f['industry'],'roles':f['roles'],'deliverables':f['deliverables'],'payment':f['payment'],'trust':f['trust']},'adopted_modules':i['map'](T=>({'id':T['id'],'name':T['name'],'description':T['description'],'requires_keeper':T['requiresKeeper'],'keeper_hint':T['keeperHint'],'user_protections':T['userProtections'],'merchant_obligations':T['merchantObligations']})),'mode_prior':N,...N?.['time_anchors']?{'time_anchor_instructions':Object['entries'](N['time_anchors'])['map'](([T,U])=>{const V=U['startsWith']('order.time')?'\x20(order-creation\x20time\x20—\x20PRE-checkout\x20branches\x20only;\x20a\x20post-checkout\x20window\x20anchored\x20here\x20is\x20unreachable)':U['startsWith']('progress.current_time')?'\x20(entry\x20time\x20of\x20the\x20window\x27s\x20source\x20node\x20—\x20witness-derived\x20via\x20OrderProgress,\x20one\x20Guard\x20serves\x20every\x20order)':U['startsWith']('absolute_date')?'\x20(per-order\x20instance\x20Guard\x20—\x20the\x20absolute\x20date\x20differs\x20per\x20booking)':'';return'Time\x20windows\x20for\x20\x27'+T+'\x27\x20anchor\x20to\x20'+U+V;})}:{},'blueprint':{'nodes':s['nodes']['map'](T=>({'id':T['id'],'type':T['type'],'purpose':T['purpose']})),'edges':s['edges']['map'](T=>({'from':T['from'],'to':T['to'],'relation':T['relation'],'required':T['required']}))},'evaluation_preview':{'estimatedRiskScore':r,'estimatedCompletenessScore':Math['min'](0x64,0x1e+i['length']*0x8),'keyRisks':q['findings']['filter'](T=>T['level']==='critical'||T['level']==='high')['map'](T=>T['title']),'strengths':q['findings']['filter'](T=>T['level']==='info')['map'](T=>T['title']),'moduleBoosts':{}},'graph_validation':{'valid':q['issues']['length']===0x0,'hard_violations':q['issues']['map'](T=>({'id':T['code'],'description':T['detail'],'fix':'Fix\x20the\x20Plan\x20structure'})),'soft_notes':q['findings']['filter'](T=>T['level']==='medium'||T['level']==='low')['map'](T=>({'id':T['rule_id'],'description':T['title']}))},'harness_check':{'module_constraints':w['map'](T=>{const U=T['module']==='discount_lifecycle'&&T['adopted']?'ADOPTION-BASED\x20satisfaction\x20(disclosure\x20obligations\x20accepted\x20with\x20module\x20adoption),\x20NOT\x20plan\x20structure:\x20creation_plan\x20intentionally\x20carries\x20no\x20Discount/SKU\x20nodes\x20—\x20they\x20are\x20minted\x20in\x20merchant\x20post-deploy\x20steps\x20and\x20verified\x20on-chain\x20after\x20deploy\x20(query\x20the\x20minted\x20Service.discount).\x20Reward\x20FUNDING\x20rides\x20review_mode\x20compile\x20emission,\x20BUT\x20the\x20reward\x20claim\x20GUARD\x20SPEC\x20must\x20still\x20be\x20declared\x20in\x20the\x20plan\x27s\x20guards[]\x20(host:\x27reward\x27)\x20—\x20compile\x20emits\x20the\x20rail\x20only\x20from\x20that\x20spec,\x20and\x20REVIEW_REWARD_GUARD_MISSING\x20hard-blocks\x20publish\x20when\x20it\x20is\x20omitted\x20(G-02,\x20onlyfans-mn\x20261019:\x20the\x20old\x20prose\x20denied\x20the\x20guard\x20spec\x20and\x20deadlocked\x20every\x20reward\x20publish).':T['reason'],V=T['evidence_matched']===![]?''+(U?U+'\x20':'')+'Adopted\x20WITHOUT\x20explicit\x20intent\x20evidence\x20(score-based\x20auto-recommendation\x20only):\x20estimated_score_boost\x20recorded\x20as\x200.\x20Keep\x20it\x20deliberately\x20or\x20drop\x20it\x20via\x20guide_state.adopted_module_ids.':U;return{'module':T['module'],'plan_satisfied':T['adopted'],'missing':T['missingConstraints'],'reason':V,'estimated_score_boost':T['estimatedScoreBoost'],'evidence_matched':T['evidence_matched']};}),'blocking_issues':[...t['map'](T=>({'module':T['module'],'missing_constraints':T['missing_constraints'],'fix':T['fix']})),...C],'module_gaps':w['filter'](T=>!T['adopted'])['map'](T=>({'module':T['module'],'missing_constraints':T['missingConstraints'],'fix':T['reason']})),'deploy_time_checks':y,'recipient_design_guidance':A},'game_theory':{'summary':K['summary'],'coverage':K['coveredCount']+'/'+K['totalCount'],'exposed_scenarios':K['exposedScenarios'],'wow_alignments':K['wowAlignments'],'scenarios':K['results']['map'](T=>({'scenario':T['scenario'],'covered':T['covered'],'conflict':T['conflict'],'user_protection':T['userProtection'],'evaluation_metric':T['evaluationMetric'],'recommendation':T['recommendation']}))},'workflow_design_assessment':{'score':L['score'],'summary':L['summary'],'findings':L['findings']['map'](T=>({'kind':T['kind'],'severity':T['severity'],'message':T['message'],'fix':T['fix']})),'checks':L['checks']['map'](T=>({'id':T['id'],'dimension':T['dimension'],'passed':T['passed'],'severity':T['severity'],'message':T['message'],'fix':T['fix']}))},'creation_plan':M,'post_deploy_steps':z,...H['length']>0x0?{'pending_guard_designs':H}:{},...H['length']>0x0&&(p['pending_guards']?.['length']??0x0)!==H['length']?{'pending_count_note':'Two\x20counts,\x20two\x20views:\x20pending_guard_designs\x20lists\x20'+H['length']+'\x20unresolved\x20design(s)\x20(compile\x20view\x20—\x20includes\x20advisory\x20designs\x20with\x20no\x20edge/rail/policy/buy\x20mount);\x20'+('the\x20plan\x20audit\x20counts\x20'+(p['pending_guards']?.['length']??0x0)+'\x20(plan\x20view\x20—\x20site-bound\x20designs\x20only;\x20the\x20rule-pack\x20titles\x20\x22of\x20N\x20pending\x20in\x20total\x22\x20quote\x20this).\x20')+'The\x20LIST\x20is\x20the\x20resolution\x20fill\x20space;\x20the\x20audit\x20number\x20is\x20its\x20site-bound\x20subset.'}:{},'warnings':[...e['warnings'],...n['omitted']['length']>0x0?['Advisory\x20guard\x20design(s)\x20omitted\x20by\x20decision\x20({kind:\x27omit\x27}):\x20'+n['omitted']['join'](',\x20')+'\x20—\x20'+'no\x20Guard\x20created,\x20nothing\x20binds\x20them\x20(run75747\x20F-38).']:[]],'next_action':B['length']>0x0?'Resolve\x20the\x20blocking_issues\x20above\x20(adjust\x20guide_confirm\x20payment/trust/modules,\x20or\x20accept\x20and\x20drop\x20the\x20affected\x20module\x20via\x20guide_confirm.adopted_module_ids),\x20then\x20call\x20merchant_guide\x20again.':q['blocking']?'The\x20plan\x20audit\x20is\x20BLOCKING\x20(see\x20harness_check.blocking_issues\x20and\x20audit.findings\x20—\x20e.g.\x20a\x20terminal\x20node\x20with\x20no\x20fund\x20exit,\x20or\x20an\x20unresolved\x20guard\x20bound\x20to\x20a\x20fund\x20path).\x20Fix\x20the\x20plan/template\x20or\x20guard\x20resolutions\x20and\x20call\x20merchant_guide\x20again;\x20do\x20NOT\x20materialize\x20this\x20plan.'+(H['length']>0x0?'\x20Pending\x20guard\x20designs:\x20'+H['length']+'\x20listed\x20in\x20pending_guard_designs\x20—\x20resolve\x20each\x20via\x20guide_confirm.guard_resolutions\x20(kind\x20\x27inline\x27\x20with\x20the\x20Guard\x20table+root,\x20kind\x20\x27template\x27\x20with\x20a\x20tpl_*\x20id,\x20or\x20{kind:\x27omit\x27}\x20for\x20advisory\x20designs\x20that\x20do\x20not\x20apply\x20to\x20this\x20shop),\x20then\x20call\x20merchant_guide\x20again.':''):'Plan\x20ready.\x20Materialize:\x20create\x20the\x20objects\x20in\x20creation_plan\x20order\x20via\x20onchain_operations,\x20then\x20run\x20post_deploy_steps\x20in\x20order\x20('+z['map'](T=>T['id'])['join'](',\x20')+').\x20WIZARD\x20CONTRACT:\x20on\x20the\x20Service\x20publish\x20call\x20(data.publish=true),\x20pass\x20this\x20exact\x20plan\x20back\x20as\x20data.creation_plan\x20—\x20the\x20publish\x20gate\x20replays\x20its\x20freeze\x20matrix\x20and\x20rejects\x20the\x20publish\x20if\x20any\x20gate\x20fails;\x20omitting\x20it\x20leaves\x20the\x20manual\x20path\x20ungated.','plan':p,'audit':{'issues':q['issues'],'findings':q['findings'],'blocking':q['blocking'],'score':r},'reflux':{'applied':o['applied'],'blocks':o['blocks'],'iterations':o['iterations']}};}export function listBusinessModules(){return CORE_BUSINESS_MODULES['map'](a=>({'id':a['id'],'name':a['name'],'description':a['description'],'industry_fit':a['industryFit'],'addresses_pain_points':a['addressesPainPoints'],'requires_keeper':a['requiresKeeper']}));}
|
|
1
|
+
import{analyzeIntent}from'./intent-analyzer.js';import{compileTemplate}from'../../composition/compile.js';import{reflux,auditScore}from'../../composition/reflux.js';import{planBlueprint}from'../../composition/blueprint-view.js';import{getGuardDesignPattern}from'../../knowledge/guard-design-patterns.js';import{GUARD_TEMPLATES,getTemplatesByScene}from'../../knowledge/guard-templates.js';import{GUARD_AFTER_SERVICE_DRAFT,relationDirection}from'../../knowledge/object-dependency.js';import{collectLateMarks}from'../../composition/plan.js';import{BUILTIN_TEMPLATES_VERSION}from'../../knowledge/builtin-templates.js';import{templateCatalogDigest}from'../../knowledge/template-loader.js';import{checkGameTheoryConstraints}from'./game-theory.js';import{assessWorkflowDesign}from'./workflow-design-assessment.js';import{getCapability,recommendCapabilities,checkCapabilityConstraints,capabilityIntentEvidence}from'../../extensions/capability.js';import{requirementCoverage}from'../../knowledge/requirement-families.js';import{recipientDesignGuidance}from'../../knowledge/recipient-constraint.js';import{getTemplate,getTemplatesByIndustry}from'../../knowledge/template-loader.js';import{resolveUserInputQuestions}from'../../knowledge/param-schema.js';import{getScenarioMode}from'../../knowledge/scenario-modes.js';function derivePlanSatisfiedConstraints(a,b){const c=new Set(),d=i=>a['edges']['some'](j=>j['relation']===i),e=i=>a['nodes']['some'](j=>j['id']===i),f=i=>a['nodes']['some'](j=>j['type']===i),g=i=>a['adoptedModules']['includes'](i);if(d('has_order_allocators'))c['add']('order_allocators_bound');if(d('uses_machine'))c['add']('machine_bound_before_publish');if(d('has_arbitration'))c['add']('arbitration_bound_to_service');if(e('machine'))c['add']('machine_published');if(e('repository'))c['add']('repository_published');if(e('service'))c['add']('service_published');e('permission_arb')&&e('permission')&&c['add']('arbitration_permission_independent');g('independent_arbitration')&&a['nodes']['some'](i=>i['id']['includes']('guard')&&i['id']['includes']('arbitration'))&&c['add']('voting_guard_configured');g('accept_timeout_protection')&&(c['add']('time_guard_configured'),c['add']('adminUnhold_permission'));g('milestone_escrow')&&f('guard')&&c['add']('milestone_forward_guarded');const h=d('has_order_allocators');if(h&&b['payment']['allocation']&&b['payment']['allocation']['length']>0x0){c['add']('allocators_configured');const i=b['payment']['allocation']['reduce']((k,l)=>k+l['percentage'],0x0);if(Math['abs'](i-0x64)<0.001)c['add']('sharing_sum_100');const j=b['payment']['allocation']['find'](k=>k['recipient']==='platform');if(!j||j['percentage']===0x0)c['add']('platform_fee_zero');g('supplier_collaboration')&&(c['add']('allocation_sharing_configured'),c['add']('demand_configured'));}g('wip_provenance')&&e('repository')&&c['add']('wip_hash_before_delivery');g('subscription_with_proof')&&e('repository')&&(c['add']('delivery_guard_per_cycle'),c['add']('repository_updated'));g('damage_attestation')&&(c['add']('pre_rental_hash'),c['add']('post_rental_hash'));g('refund_guarantee')&&(c['add']('compensation_fund_positive'),c['add']('refund_guard_configured'));if(g('praise_incentive')){const k=a['plan']['steps']['some'](m=>m['op']==='create'&&m['object']==='reward'),l=a['plan']['steps']['some'](m=>m['op']==='configure'&&m['method']==='coin_add');k&&l&&(c['add']('reward_pool_funded'),c['add']('reward_claim_replay_armed'));}g('discount_lifecycle')&&(c['add']('discount_budget_planned'),c['add']('discount_burn_disclosed'));if(g('after_sales_guarantee')){const m=a['plan']['steps']['find'](p=>p['op']==='create'&&p['object']==='machine'),n=m?.['params']?.['nodes']??[],o=n['some'](p=>/return|refund|exchange|replace|reship|swap|warranty|repair/i['test'](p['name']??''));o&&(c['add']('after_sales_rail_present'),c['add']('after_sales_rail_node_gated'),c['add']('after_sales_window_anchored'),c['add']('after_sales_no_double_remedy'));}if(g('acceptance_judging')){const p=a['plan']['steps']['find'](t=>t['op']==='create'&&t['object']==='machine'),q=p?.['params']?.['nodes']??[],r=q['map'](t=>t['name']??''),s=r['some'](t=>/accept|approv|award|ruling|place|placement|triage|vot|evaluat|winner|judge/i['test'](t));if(s){const t=r['some'](u=>/revis|redeliver|resubmit|rework/i['test'](u));c['add']('acceptance_race_free');if(e('arbitration'))c['add']('acceptance_judge_independent');if(!t||e('repository'))c['add']('acceptance_revision_bounded');}}if(g('installment_deposit')){const u=a['plan']['steps']['find'](z=>z['op']==='create'&&z['object']==='machine'),v=u?.['params']?.['nodes']??[],w=v['map'](z=>z['name']??''),x=w['some'](z=>/(deposit|down_?pay|balance_due|balance_owed|installment|milestone|awaiting|owed)/i['test'](z)),y=w['some'](z=>/(paid|funded|captured|settled)/i['test'](z));x&&y&&(c['add']('installment_funding_gated'),c['add']('installment_deposit_exit'),c['add']('installment_release_once'));}if(g('affiliate_commission')){const z=a['plan']['steps']['find'](D=>D['op']==='create'&&D['object']==='machine'),A=z?.['params']?.['nodes']??[],B=A['map'](D=>D['name']??''),C=B['some'](D=>/(commission|affiliate|referr|attribut|partner_?payout)/i['test'](D));C&&(c['add']('affiliate_rail_present'),c['add']('affiliate_clawback_disclosed'),c['add']('affiliate_window_anchored'));}if(g('crowdfunding')){const D=a['plan']['steps']['find'](H=>H['op']==='create'&&H['object']==='machine'),E=D?.['params']?.['nodes']??[],F=E['map'](H=>H['name']??''),G=F['some'](H=>/(releas|settle|funded|disburs|project)/i['test'](H));G&&(c['add']('crowdfunding_exit_rail_present'),c['add']('crowdfunding_aggregate_writer_bound'),c['add']('crowdfunding_disclosure_present'));}if(g('logistics_fulfillment')){const H=a['plan']['steps']['find'](L=>L['op']==='create'&&L['object']==='machine'),I=H?.['params']?.['nodes']??[],J=I['map'](L=>L['name']??''),K=J['some'](L=>/(dispatch|handover|hand_over|pickup|deliver|courier|rider|shipped)/i['test'](L));K&&(c['add']('logistics_rail_present'),c['add']('logistics_loss_covered'),c['add']('logistics_fee_independent'),c['add']('logistics_dispatch_disclosed'));}return c;}function deriveDeployTimeChecks(a,b=![]){const c=[];return a['nodes']['some'](d=>d['id']==='machine')&&c['push']('Machine\x20published\x20AND\x20bound\x20to\x20Service\x20BEFORE\x20Service.publish\x20(machine\x20is\x20immutable\x20after\x20publish)'),a['edges']['some'](d=>d['relation']==='has_order_allocators')&&(c['push']('Service.order_allocators\x20bound\x20(verify\x20via\x20query_objects\x20after\x20publish\x20—\x20order_allocators\x20is\x20FROZEN\x20at\x20publish)'),c['push']('Settlement\x20is\x20NOT\x20triggered\x20by\x20reaching\x20a\x20Machine\x20node\x20alone\x20—\x20an\x20explicit\x20alloc_by_guard\x20call\x20(keeper\x20or\x20merchant)\x20fires\x20the\x20settlement\x20Allocator\x20once\x20its\x20Guard\x20passes.\x20Declare\x20the\x20node->allocator\x20trigger\x20(which\x20terminal\x20node\x20unlocks\x20settlement)\x20and\x20schedule\x20the\x20keeper\x20step;\x20otherwise\x20orders\x20stall\x20at\x20the\x20settle\x20node\x20with\x20allocation_state=pending'),c['push']('ALLOCATOR\x20GUARD\x20DESIGN\x20—\x20hand-built\x20rails\x20(sahr\x20lesson):\x20BEFORE\x20writing\x20the\x20settlement\x20Guard,\x20map\x20the\x20host\x20object\x27s\x20RICH\x20STATES:\x20enumerate\x20the\x20Machine\x27s\x20terminal\x20nodes\x20(settlement\x20vs\x20refund\x20polarity),\x20the\x20mid-flight\x20states\x20a\x20claim\x20or\x20dispute\x20opens,\x20and\x20which\x20business\x20event\x20each\x20state\x20transition\x20represents;\x20the\x20allocator\x20gate\x20must\x20sit\x20at\x20exactly\x20ONE\x20mapped\x20transition\x20(e.g.\x20\x27order\x20reached\x20settle\x20terminal\x20AND\x20business\x20obligations\x20verified\x27),\x20never\x20at\x20\x27any\x20time\x20after\x20start\x27.\x20Then\x20bind\x20WHO\x20may\x20trigger\x20alloc_by_guard:\x20the\x20gate\x20carries\x20a\x20caller-identity\x20leg\x20—\x20context(Signer)\x20compared\x20against\x20a\x20table\x20entry,\x20a\x20permission.admin\x20/\x20order.owner\x20read,\x20or\x20the\x20named-operator\x20roster\x20query.\x20order.claimed_by\x20is\x20ORDER\x20STATE,\x20not\x20a\x20caller\x20binding\x20—\x20a\x20gate\x20whose\x20legs\x20read\x20only\x20order/progress/clock\x20state\x20is\x20callable\x20by\x20ANY\x20address,\x20and\x20a\x20bystander\x20can\x20accelerate\x20someone\x20else\x27s\x20payout\x20(sahr,\x20live-proven)'),c['push']('ALLOCATOR\x20GUARD\x20REVIEW\x20—\x20pre-publish,\x20semantic\x20alignment:\x20SAFETY\x20—\x20a\x20settlement\x20track\x20with\x20refund\x20exposure\x20carries\x20the\x20dispute\x20freeze\x20leg\x20logic_not[order.dispute.open]\x20(query\x201576)\x20so\x20a\x20filed\x20dispute\x20freezes\x20new\x20settlements;\x20resolved-awaiting-stamp\x20flows\x20drive\x20the\x20stamp\x20with\x20order.dispute.unstamped\x20(query\x201578).\x20EFFECTIVENESS\x20—\x20read\x20every\x20gate\x20leg\x20back\x20against\x20the\x20business\x20description\x20(who\x20SHOULD\x20trigger,\x20at\x20which\x20business\x20milestone,\x20with\x20what\x20evidence):\x20structural\x20lint\x20passing\x20is\x20NOT\x20semantic\x20alignment.\x20Run\x20the\x20template\x20scan\x20dry-run\x20before\x20publish\x20—\x20the\x20knowledge\x20face\x20discloses\x20identity-less\x20allocator\x20gates\x20as\x20RAIL_NO_CALLER_IDENTITY\x20(info,\x20never\x20blocking);\x20treat\x20the\x20disclosure\x20as\x20a\x20design-review\x20flag\x20and\x20resolve\x20it\x20either\x20with\x20a\x20caller-identity\x20leg\x20or\x20a\x20DOCUMENTED\x20open-trigger\x20rationale\x20(scene\x20verifies\x20identity\x20upstream\x20/\x20intentionally\x20open\x20venue),\x20never\x20by\x20silence'),c['push']('ALLOCATOR\x20RULING\x20DIRECTION\x20—\x20the\x20rich-state\x20matrix\x20closes\x20BOTH\x20ruling\x20outcomes:\x20an\x20award\x20exit\x20on\x20the\x20ARBITRATION\x20indemnity\x20track\x20(a\x20tpl_forward_arb_ruling_won\x20claimed_by==true\x20leg\x20is\x20legal\x20arb-side\x20state,\x20decision\x2011)\x20bound\x20ONLY\x20to\x20a\x20buyer-side\x20identity\x20(order.owner/agent)\x20is\x20unreachable\x20after\x20a\x20MERCHANT-favored\x20ruling\x20or\x20dismissal\x20—\x20nobody\x20but\x20the\x20buyer\x20can\x20open\x20the\x20exit\x20and\x20the\x20escrow\x20principal\x20strands\x20(w3k7\x20m2:\x201.25\x20WOW\x20held\x20on\x20a\x20fully-guarded\x20order;\x20the\x20protocol\x20is\x20direction-blind,\x20the\x20order\x20object\x20exposes\x20NO\x20winner\x20accessor,\x20so\x20the\x20guard\x20itself\x20cannot\x20branch\x20on\x20who\x20won).\x20Pair\x20the\x20buyer-side\x20award\x20exit\x20with\x20a\x20merchant-side\x20exit\x20(a\x20terminal-node-gated\x20recovery\x20sweep\x20—\x20the\x20canonical\x20recover\x20rail),\x20or\x20document\x20that\x20the\x20keeper\x20dual-payout\x20protocol\x20is\x20the\x20intended\x20sole\x20post-ruling\x20exit.\x20Overlap\x20between\x20an\x20award\x20and\x20a\x20fund-rail\x20payout\x20is\x20LEGAL\x20under\x20decision\x2011\x20and\x20is\x20disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate\x20—\x20resolve\x20reachability\x20before\x20publish,\x20never\x20by\x20silence.\x20INVERTED\x20FUNDING\x20award-recipient\x20face\x20(W5-01\x20d;\x20the\x20order-side\x20award\x20payout\x20hard-binds\x20to\x20the\x20order\x20owner\x20on\x20both\x20compensate\x20and\x20conclude\x20paths):\x20a\x20ruling\x20pays\x20ONLY\x20the\x20compensation\x20indemnity,\x20never\x20the\x20escrow\x20principal\x20—\x20and\x20on\x20an\x20INVERTED-FUNDING\x20build\x20(bounty/contest:\x20the\x20SPONSOR\x20is\x20the\x20order_payer,\x20so\x20order.owner\x20IS\x20the\x20funder)\x20a\x20hunter/designer-side\x20win\x20pays\x20THE\x20SPONSOR,\x20not\x20the\x20winning\x20party;\x20state\x20both\x20directions\x20(award\x20recipient\x20+\x20principal\x20exit\x20via\x20the\x20recover\x20rail\x27s\x20note)\x20in\x20the\x20storefront/quote\x20before\x20publish')),(a['adoptedModules']['includes']('refund_guarantee')||a['nodes']['some'](d=>d['id']==='arbitration'))&&(b?c['push']('COMPENSATION\x20FUND:\x20DO\x20NOT\x20FUND\x20—\x20this\x20template\x20declares\x20compensation_fund_policy=forbidden\x20(the\x20unreserved\x20pool\x20is\x20double-takeable\x20via\x20refund-then-claim\x20until\x20the\x20arbitration-escrow\x20shared\x20gate\x20lands;\x20user\x20ruling\x202026-10-15).\x20Disputes\x20ride\x20the\x20escrow\x20rails\x20only;\x20the\x20compensation_fund_topup\x20post-deploy\x20step\x20is\x20intentionally\x20absent'):c['push']('compensation_fund\x20MUST\x20be\x20able\x20to\x20cover\x20payouts:\x20a\x20claim\x20against\x20a\x20drained\x20fund\x20aborts\x20with\x20E_COMPENSATION_NOT_MATCH.\x20Size\x20the\x20fund\x20>=\x203x\x20a\x20TYPICAL\x20single\x20order\x20(3x\x20IS\x20the\x20chain\x27s\x20hard\x20award\x20ceiling,\x20MAX_INDEMNITY_MULTIPLE)\x20—\x20per-order\x20coverage\x20is\x20enforced\x20at\x20BUY\x20time\x20(each\x20order\x20is\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount,\x20not\x203x\x20the\x20highest\x20SKU),\x20so\x20publish\x20no\x20longer\x20blocks\x20on\x20coverage;\x20verify\x20the\x20on-chain\x20balance\x20before\x20going\x20live.\x205R-07③:\x20after\x20go-live\x20the\x20keeper\x20WATCHES\x20the\x20water\x20level\x20(see\x20the\x20compensation_fund_watch\x20step)\x20—\x20no\x20hard\x20gate,\x20the\x20merchant\x20decides')),a['nodes']['some'](d=>d['id']==='arbitration')&&(c['push']('Arbitration\x20activation\x20is\x20ATOMIC\x20in\x20the\x20creation\x20plan\x20—\x20the\x20chain\x20hardcodes\x20every\x20new\x20Arbitration\x20to\x20PAUSED\x20at\x20construction,\x20and\x20the\x20plan\x27s\x20arbitration\x20create\x20payload\x20carries\x20pause:false,\x20which\x20the\x20executor\x20composes\x20as\x20the\x20unpause\x20write\x20in\x20the\x20SAME\x20transaction\x20(the\x20creator\x20is\x20the\x20new\x20Permission\x27s\x20admin,\x20so\x20the\x20356\x20assert\x20passes).\x20Verify\x20the\x20paused\x20flag\x20reads\x20false\x20after\x20materialization\x20(a\x20paused\x20venue\x20aborts\x20every\x20dispute\x20filing).\x20Keep\x20Arbitration.permission\x20distinct\x20from\x20Service.permission\x20on-chain\x20(E_ARBITRATION_PERMISSION_CONFLICT=33)'),c['push']('ARBITRATION\x20VENUE\x20OWNERSHIP\x20(D-5):\x20the\x20recommended\x20onboarding\x20default\x20is\x20a\x20SELF-BUILT\x20venue\x20—\x20your\x20own\x20Arbitration\x20object\x20with\x20your\x20own\x20permission/admin\x20(voting_guard\x20tpl_voting_guard_open_vote\x20for\x20community\x20cases,\x20tpl_voting_guard_numeric_weight\x20for\x20a\x20named\x20panel).\x20A\x20THIRD-PARTY\x20venue\x20you\x20do\x20not\x20control\x20hands\x20the\x20private\x20key\x20that\x20answers\x20and\x20appeals\x20cases\x20to\x20its\x20operator:\x20an\x20outside\x20store\x27s\x20admin\x20going\x20silent\x20strands\x20your\x20defense\x20(F-16,\x20live-proven).\x20Use\x20an\x20outside\x20venue\x20ONLY\x20when\x20its\x20operator\x20is\x20a\x20named,\x20reachable\x20counterparty\x20the\x20merchant\x20accepts')),a['nodes']['some'](d=>d['id']==='repository')&&c['push']('Repository\x20published\x20and\x20Guard\x20write\x20validation\x20configured'),c['push']('After\x20materialization,\x20confirm\x20the\x20on-chain\x20state\x20matches\x20this\x20plan\x20(query_toolkit\x20query_type=\x27service_panorama\x27)'),c;}function derivePostDeploySteps(a,b=![],c=![]){const d=[];return!b&&(a['adoptedModules']['includes']('refund_guarantee')||a['nodes']['some'](e=>e['id']==='arbitration'))&&(!c&&d['push']({'order':d['length']+0x1,'id':'compensation_fund_topup','title':'Top\x20up\x20the\x20compensation\x20fund','when':'After\x20the\x20Service\x20PUBLISHES\x20successfully\x20(post-publish,\x20before\x20the\x20store\x20goes\x20live\x20to\x20buyers)','action':'Call\x20compensation_fund_add\x20sized\x20>=\x203x\x20a\x20TYPICAL\x20single\x20order\x20(3x\x20=\x20the\x20chain\x27s\x20hard\x20award\x20ceiling,\x20MAX_INDEMNITY_MULTIPLE;\x20above\x203x\x20only\x20buys\x20headroom\x20for\x20concurrent\x20claims).\x20Per-order\x20coverage\x20is\x20enforced\x20at\x20BUY\x20time\x20—\x20each\x20incoming\x20order\x20is\x20checked\x20against\x203x\x20ITS\x20OWN\x20amount\x20and\x20under-covered\x20orders\x20cannot\x20be\x20created\x20—\x20then\x20verify\x20the\x20on-chain\x20fund\x20balance\x20via\x20query_objects','tool_hint':'onchain_operations\x20(service.compensation_fund_add)','failure_if_skipped':'a\x20compensation\x20claim\x20against\x20an\x20empty\x20fund\x20aborts\x20(E_COMPENSATION_NOT_MATCH,\x20testnet\x20lesson\x20R-4)'}),d['push']({'order':d['length']+0x1,'id':'compensation_fund_watch','title':'Watch\x20the\x20compensation-fund\x20water\x20level\x20(recurring\x20keeper\x20step)','when':'Recurring\x20—\x20on\x20every\x20keeper\x20cycle\x20after\x20go-live,\x20and\x20ALWAYS\x20immediately\x20after\x20each\x20arbitration\x20payout\x20posts','action':'Query\x20the\x20on-chain\x20fund\x20balance\x20and\x20classify\x20it\x20with\x20classifyFundWaterLevel(balance,\x20low_water_threshold)\x20into\x20THREE\x20tiers:\x20HEALTHY\x20(balance\x20>=\x20threshold\x20—\x20silence\x20is\x20the\x20healthy\x20signal,\x20no\x20event)\x20/\x20LOW\x20WATER\x20(0\x20<\x20balance\x20<\x20threshold\x20—\x20surface\x20fundWaterReminder:\x20recommend\x20topping\x20up\x20via\x20compensation_fund_add;\x20one\x20large\x20award\x20could\x20make\x20a\x20flagship\x20SKU\x20unbuyable,\x20F-46)\x20/\x20DEPLETED\x20(balance\x200\x20—\x20surface\x20fundWaterReminder\x20LOUD:\x20every\x20claim\x20aborts\x2027\x20and\x20under-covered\x20SKUs\x20are\x20unbuyable).\x20Thresholds\x20are\x20the\x20MERCHANT\x27s\x20call\x20(decision\x207)\x20—\x20recommended\x20anchor:\x20low-water\x20line\x20at\x203x\x20the\x20flagship\x20SKU\x20price\x20(below\x20it\x20the\x20flagship\x20can\x20no\x20longer\x20be\x20bought),\x20healthy\x20line\x20at\x203x\x20the\x20typical\x20order.\x20NEVER\x20block\x20a\x20SKU\x20or\x20gate\x20a\x20claim\x20on\x20the\x20tier\x20—\x20the\x20reminder\x20is\x20the\x20whole\x20feature;\x20the\x20merchant\x20decides\x20(top\x20up\x20/\x20accept\x20the\x20exposure)','tool_hint':'query_toolkit\x20(service_panorama:\x20fund\x20balance)\x20+\x20fund-layer\x20classifyFundWaterLevel\x20+\x20onchain_operations\x20(service.compensation_fund_add)\x20on\x20the\x20merchant\x27s\x20decision','failure_if_skipped':'a\x20drained\x20or\x20low\x20fund\x20is\x20SILENT\x20—\x20the\x20first\x20signal\x20is\x20a\x20buyer\x27s\x20claim\x20aborting\x20(27)\x20or\x20a\x20flagship\x20SKU\x20failing\x20to\x20sell\x20(buy-time\x203x\x20coverage\x20refusal,\x20F-46)'})),a['nodes']['some'](e=>e['id']==='arbitration')&&(d['push']({'order':d['length']+0x1,'id':'arbitration_unpause','title':'Verify\x20the\x20Arbitration\x20is\x20ACTIVE\x20(activation\x20rode\x20the\x20create)','when':'Immediately\x20after\x20materialization\x20—\x20before\x20the\x20store\x20goes\x20live\x20to\x20buyers','action':'The\x20creation\x20plan\x27s\x20arbitration\x20create\x20payload\x20carries\x20pause:false\x20(the\x20chain\x20hardcodes\x20new\x20Arbitrations\x20to\x20paused;\x20the\x20executor\x20composes\x20the\x20unpause\x20in\x20the\x20same\x20transaction)\x20—\x20VERIFY\x20the\x20paused\x20flag\x20reads\x20false\x20via\x20query_toolkit;\x20only\x20an\x20already-paused\x20leftover\x20venue\x20(built\x20before\x20this\x20payload\x20field\x20existed)\x20needs\x20a\x20manual\x20unpause.\x20Keep\x20its\x20Permission\x20distinct\x20from\x20the\x20Service\x20Permission\x20(E_ARBITRATION_PERMISSION_CONFLICT=33)','tool_hint':'query_toolkit\x20(arbitration\x20paused\x20flag);\x20manual\x20unpause\x20via\x20onchain_operations\x20(arbitration\x20pause:false)\x20ONLY\x20for\x20a\x20legacy\x20paused\x20venue','failure_if_skipped':'a\x20paused\x20Arbitration\x20aborts\x20every\x20dispute\x20filing\x20(testnet\x20lesson\x20R-5)'}),d['push']({'order':d['length']+0x1,'id':'arbitration_permission_write','title':'Grant\x20the\x20operator\x20account\x20its\x20venue-management\x20permissions','when':'After\x20the\x20Arbitration\x20object\x20is\x20created,\x20BEFORE\x20any\x20venue-management\x20call\x20(description/guard/fee/pause\x20edits)\x20from\x20the\x20operator\x20account','action':'Write\x20the\x20operator\x20permission\x20row:\x20onchain_operations\x20operation_type=\x27permission\x27,\x20data={object:\x27<arbitration_permission_object>\x27,\x20table:{op:\x27add\x20perm\x20by\x20entity\x27,\x20entity:\x27<operator_account>\x27,\x20index:[350,351,354,356,357,359]}}\x20—\x20350\x20file\x20new\x20cases,\x20351\x20description,\x20354\x20voting_guard\x20management,\x20356\x20pause/resume,\x20357\x20fee,\x20359\x20ruling.\x20The\x20arbitration\x20Permission\x20table\x20starts\x20EMPTY\x20with\x20only\x20the\x20creator\x20seeded\x20as\x20admin,\x20so\x20without\x20this\x20row\x20every\x20operator\x20call\x20aborts\x20on\x20the\x20permission\x20assert.\x20entity\x20must\x20be\x20a\x20FULL\x2066-char\x200x\x20address\x20or\x20a\x20local\x20mark\x20name\x20—\x20a\x20truncated\x20address\x20normalizes\x20to\x20a\x20DIFFERENT\x20on-chain\x20address\x20and\x20grants\x20the\x20wrong\x20row\x20silently','tool_hint':'onchain_operations\x20(permission\x20add\x20perm\x20by\x20entity,\x20indexes\x20350/351/354/356/357/359)','failure_if_skipped':'the\x20operator\x20account\x20holds\x20NO\x20rows\x20in\x20the\x20arbitration\x20Permission\x20table\x20—\x20every\x20venue-management\x20call\x20from\x20it\x20aborts\x20on\x20the\x20permission\x20assert\x20(permission\x20350-359\x20failures)'}),d['push']({'order':d['length']+0x1,'id':'arbitration_arbitrator_grant','title':'Grant\x20the\x20arbitrator\x20account\x20its\x20case-lifecycle\x20permissions','when':'After\x20arbitration_permission_write,\x20BEFORE\x20the\x20first\x20dispute\x20reaches\x20voting','action':'Write\x20the\x20arbitrator\x20permission\x20row:\x20same\x20permission-object\x20call\x20shape\x20with\x20entity:\x27<arbitrator_account>\x27\x20and\x20index:[358,359,360,361,362,363,364]\x20—\x20358\x20vote,\x20359\x20ruling,\x20360\x20feedback,\x20361\x20confirm,\x20362\x20voting-deadline\x20change,\x20363\x20reset,\x20364\x20receive.\x20Note:\x20the\x20disputing\x20CUSTOMER\x20must\x20hold\x20358\x20for\x20their\x20vote\x20to\x20count\x20(a\x20plain\x20vote\x20with\x20an\x20empty\x20voting_guard\x20still\x20asserts\x20358\x20—\x20ungranted,\x20voting\x20collapses\x20to\x20admin-only,\x20E-13);\x20that\x20per-dispute\x20customer\x20grant\x20is\x20issued\x20at\x20filing\x20time,\x20NOT\x20in\x20this\x20step.\x20Full\x2066-char\x20address\x20or\x20mark\x20name\x20only','tool_hint':'onchain_operations\x20(permission\x20add\x20perm\x20by\x20entity,\x20indexes\x20358-364)','failure_if_skipped':'358-364\x20stay\x20creator-admin-only\x20—\x20the\x20named\x20arbitrator\x20cannot\x20vote/rule/confirm,\x20and\x20the\x20customer\x27s\x20vote\x20collapses\x20to\x20admin-only\x20(E-13),\x20dead-locking\x20the\x20first\x20dispute'}),d['push']({'order':d['length']+0x1,'id':'voting_guard_open_vote','title':'Bind\x20the\x20open-vote\x20voting_guard\x20(tpl_voting_guard_open_vote)','when':'After\x20the\x20Arbitration\x20is\x20activated,\x20BEFORE\x20the\x20first\x20dispute\x20can\x20be\x20voted\x20on','action':'Create\x20the\x20open-vote\x20guard\x20(tpl_voting_guard_open_vote:\x20always-true\x20root\x20+\x20FixedValue\x20weight\x201\x20=\x20one\x20person\x20one\x20vote)\x20and\x20set\x20it\x20as\x20the\x20Arbitration\x27s\x20voting_guard;\x20skip\x20this\x20step\x20ONLY\x20for\x20a\x20deliberately\x20closed\x20panel\x20(then\x20bind\x20tpl_voting_guard_numeric_weight\x20with\x20the\x20arbitrator\x20address\x20list\x20instead)','tool_hint':'onchain_operations\x20(guard\x20creation\x20+\x20arbitration\x20voting_guard\x20set,\x20op=\x27set\x27)','failure_if_skipped':'an\x20EMPTY\x20voting_guard\x20dead-locks\x20every\x20plain\x20vote\x20on\x20permission\x20358\x20(creator-admin\x20only)\x20—\x20the\x20first\x20dispute\x20cannot\x20reach\x20a\x20verdict\x20if\x20the\x20admin\x20is\x20unresponsive\x20(crs9-F-36,\x20R-ARB-VOTE-LOCK)'})),a['edges']['some'](f=>f['relation']==='has_order_allocators')&&d['push']({'order':d['length']+0x1,'id':'settlement_alloc_by_guard','title':'Fire\x20settlement\x20via\x20alloc_by_guard\x20(keeper\x20or\x20merchant\x20step)','when':'Recurring\x20—\x20after\x20EACH\x20order\x20reaches\x20its\x20settlement\x20terminal\x20node\x20(declare\x20which\x20node\x20unlocks\x20settlement)','action':'Call\x20alloc_by_guard\x20on\x20the\x20order\x27s\x20allocation\x20with\x20the\x20settlement\x20Guard;\x20reaching\x20the\x20Machine\x20node\x20alone\x20does\x20NOT\x20settle\x20(allocation_state\x20stays\x20pending)','tool_hint':'onchain_operations\x20(allocation.alloc_by_guard);\x20schedule\x20as\x20a\x20keeper\x20step','failure_if_skipped':'orders\x20stall\x20at\x20the\x20settle\x20node\x20with\x20funds\x20locked\x20in\x20escrow\x20(testnet\x20lesson\x20R-2)'}),d['push']({'order':d['length']+0x1,'id':'verify_service_panorama','title':'Verify\x20the\x20on-chain\x20state\x20matches\x20the\x20plan','when':'After\x20all\x20creation\x20steps\x20and\x20the\x20steps\x20above\x20are\x20done','action':'Run\x20the\x20service\x20panorama\x20query\x20and\x20diff\x20it\x20against\x20this\x20plan\x27s\x20blueprint/creation_plan','tool_hint':'query_toolkit\x20query_type=\x27service_panorama\x27','failure_if_skipped':'plan/chain\x20drift\x20(missing\x20binding,\x20wrong\x20allocator\x20order)\x20stays\x20undetected\x20until\x20an\x20order\x20hits\x20it'}),d;}function buildCreationPlan(a){const b=[],c=new Map(a['nodes']['map'](j=>[j['id'],j])),f=new Map();for(const j of a['nodes'])f['set'](j['id'],new Set());for(const k of a['edges']){if(!f['has'](k['from'])||!c['has'](k['to']))continue;const l=relationDirection(k['relation'])==='to_depends_on_from',m=l?k['to']:k['from'],o=l?k['from']:k['to'];if(m===o||!f['has'](m))continue;f['get'](m)['add'](o);}for(const p of a['nodes']){for(const q of Object['values'](p['config'])){q['type']==='address_ref'&&q['targetId']!==p['id']&&f['has'](q['targetId'])&&f['get'](p['id'])['add'](q['targetId']);}}{const r=GUARD_AFTER_SERVICE_DRAFT,s=a['nodes']['filter'](t=>t['type']===r['provider'])['map'](t=>t['id']);if(s['length']>0x0)for(const t of a['nodes']){if(t['type']!==r['dependent'])continue;const u=f['get'](t['id']);if(u===undefined)continue;for(const v of s)u['add'](v);}}const g=new Map([...f]['map'](([w,x])=>[w,[...x]])),h=[],i=new Map(f);while(i['size']>0x0){const w=[...i['entries']()]['filter'](([,x])=>x['size']===0x0)['map'](([x])=>x);if(w['length']===0x0){h['push'](...i['keys']());break;}w['sort']();for(const x of w){h['push'](x),i['delete'](x);for(const y of i['values']())y['delete'](x);}}return h['forEach']((z,A)=>{const B=c['get'](z),C=B['config']['name'],D=C?.['type']==='string'?C['value']:z,E=D['includes']('/')?D['replaceAll']('/','__'):D,F=z==='arbitration'?'Create\x20'+B['type']+'\x20via\x20onchain_operations\x20WITH\x20pause:false\x20(creation-time\x20activation),\x20then\x20configure.\x20Purpose:\x20'+B['purpose']:'Create\x20'+B['type']+'\x20via\x20onchain_operations,\x20then\x20configure.\x20Purpose:\x20'+B['purpose'];b['push']({'order':A+0x1,'node_id':z,'object_type':B['type'],'suggested_name':E,'depends_on':g['get'](z)??[],'operation_hint':F});}),b;}function resolveTemplate(a,b){if(!a)return undefined;const c=getTemplate(a);if(c)return c;const d=getTemplatesByIndustry(a);if(b){const f=b['toLowerCase'](),g=d['filter'](h=>{const i=String(h['product_ref']??'')['trim']()['toLowerCase']();return i['length']>0x0&&f['includes'](i);});if(g['length']===0x1)return g[0x0];}const e=getScenarioMode(a)?.['default_template'];if(e){const h=getTemplate(e);if(h)return h;}if(d['length']>0x0)return d[0x0];return undefined;}export const GAS_PER_ORDER_SMALLEST=0x5b8d80;export const MIN_ECONOMIC_ORDER_SMALLEST=0x2faf080;const GAS_RATIO_WARN_THRESHOLD=0.1,wow=a=>Number((a/0x3b9aca00)['toFixed'](0x6))+'\x20WOW';export function gasEconomicsWarnings(a,b){const c=[],d=(a??[])['map'](j=>Number(j?.['price']))['filter'](j=>Number['isFinite'](j)&&j>0x0);if(d['length']===0x0)return c;const e=Math['min'](...d),f=Number(b),g=Number['isFinite'](f)&&f>0x0?f:0x0,h=g+GAS_PER_ORDER_SMALLEST,i=h/e;if(e<MIN_ECONOMIC_ORDER_SMALLEST)c['push']('GAS\x20ECONOMY\x20(ddmc4\x20B-39\x20/\x20ks7\x20A-10):\x20the\x20cheapest\x20SKU\x20is\x20'+wow(e)+'\x20—\x20below\x20the\x20≈'+wow(MIN_ECONOMIC_ORDER_SMALLEST)+'\x20minimum\x20ECONOMIC\x20per-order\x20price.\x20'+('Measured\x20settlement\x20gas\x20is\x20≈'+wow(GAS_PER_ORDER_SMALLEST)+'\x20per\x20transaction')+(g>0x0?',\x20plus\x20'+wow(g)+'\x20cashback\x20per\x20claim':'')+('\x20—\x20per-order\x20overhead\x20≈'+wow(h)+'\x20('+Math['round'](i*0x64)+'%\x20of\x20this\x20SKU).\x20')+'Micro-priced\x20SKUs\x20lose\x20their\x20entire\x20margin\x20to\x20gas:\x20raise\x20the\x20price,\x20drop\x20the\x20per-claim\x20cashback,\x20or\x20batch\x20settlements.');else i>GAS_RATIO_WARN_THRESHOLD&&c['push']('GAS\x20ECONOMY\x20(ks7\x20A-10):\x20cashback\x20+\x20settlement\x20gas\x20≈'+wow(h)+'\x20per\x20order\x20is\x20'+Math['round'](i*0x64)+'%\x20of\x20the\x20cheapest\x20SKU\x20('+wow(e)+')\x20—\x20above\x20the\x2010%\x20warning\x20line.\x20'+'Trim\x20the\x20per-claim\x20cashback\x20or\x20raise\x20the\x20price.');return c;}export async function handleMerchantGuide(a){const b=a['guide_state']??{'intent_text':''},d=a['guide_confirm']??{},e={'intent_text':(a['intent']??b['intent_text']??'')['trim'](),'confirmed_industry':d['industry']??b['confirmed_industry'],'currency':d['currency']??b['currency'],'deliverables':d['deliverables']??b['deliverables'],'payment_override':d['payment']??b['payment_override'],'trust_override':d['trust']??b['trust_override'],'adopted_module_ids':d['adopted_module_ids']??b['adopted_module_ids'],'guard_resolutions':{...b['guard_resolutions']??{},...d['guard_resolutions']??{}},'review_mode':d['review_mode']??b['review_mode'],'reward_funding':d['reward_funding']??b['reward_funding'],'reward_claim_amount':d['reward_claim_amount']??b['reward_claim_amount'],'after_sales_mode':d['after_sales_mode']??b['after_sales_mode'],'acceptance_mode':d['acceptance_mode']??b['acceptance_mode'],'installment_mode':d['installment_mode']??b['installment_mode'],'affiliate_mode':d['affiliate_mode']??b['affiliate_mode'],'crowdfunding_mode':d['crowdfunding_mode']??b['crowdfunding_mode'],'logistics_mode':d['logistics_mode']??b['logistics_mode'],'supply_chain':d['supply_chain']??b['supply_chain'],'sales':d['sales']??b['sales']};for(const T of Object['keys'](e)){if(e[T]===undefined)delete e[T];}if(e['guard_resolutions']&&Object['keys'](e['guard_resolutions'])['length']===0x0)delete e['guard_resolutions'];if(!e['intent_text'])throw new Error('merchant_guide\x20requires\x20\x27intent\x27\x20(business\x20description)\x20for\x20Step\x201.\x20'+'Example:\x20intent=\x27I\x20want\x20to\x20offer\x20online\x20design\x20service\x20with\x20milestone\x20payments\x27.\x20'+'Pass\x20the\x20returned\x20guide_state\x20back\x20UNCHANGED\x20on\x20subsequent\x20calls,\x20plus\x20guide_confirm\x20for\x20merchant\x20decisions.');const f=await analyzeIntent(e['intent_text'],{'preferredIndustry':e['confirmed_industry'],'currency':e['currency']});if(!e['confirmed_industry'])return{'action':'merchant_guide','current_step':0x2,'step_name':'Industry\x20Matching','guide_state':e,'intent_draft':f['intent'],'industry_options':{'inferred':f['inferredIndustry'],'confidence':f['industryConfidence'],'similar':f['similarIndustries']},'warnings':f['warnings'],'next_action':'Confirm\x20the\x20industry\x20by\x20calling\x20merchant_guide\x20again\x20with\x20guide_state\x20(UNCHANGED)\x20'+('plus\x20guide_confirm={\x20industry:\x20\x27<one\x20of:\x20'+f['similarIndustries']['join'](',\x20')+'\x20—\x20or\x20any\x20other\x20industry\x20id>\x27\x20}')};const g={...f['intent'],'industry':e['confirmed_industry'],'deliverables':e['deliverables']??f['intent']['deliverables'],'payment':{...f['intent']['payment'],...e['payment_override']??{}},'trust':{...f['intent']['trust'],...e['trust_override']??{}}},h=!!e['adopted_module_ids'],i=e['adopted_module_ids']?e['adopted_module_ids']['map'](U=>getCapability(U))['filter'](U=>!!U):recommendCapabilities(e['confirmed_industry'],e['intent_text'],{'maxCapabilities':0x5}),j=a['template_override']??resolveTemplate(e['confirmed_industry'],e['intent_text']);if(!j)throw new Error('No\x20compilable\x20template\x20found\x20for\x20industry\x20\x27'+e['confirmed_industry']+'\x27.\x20'+'Register\x20a\x20template\x20via\x20industry_pack_operation\x20or\x20pass\x20template_override\x20explicitly.');const l=resolveUserInputQuestions(j),m={'currency':e['currency']??g['payment']['currency'],...e['payment_override']?{'payment':e['payment_override']}:{},...e['trust_override']?{'trust':e['trust_override']}:{},...e['deliverables']?{'deliverables':e['deliverables']}:{},...e['adopted_module_ids']?{'adopted_module_ids':e['adopted_module_ids']}:{},...e['review_mode']?{'review_mode':e['review_mode']}:{},...e['reward_funding']!==undefined?{'reward_funding':e['reward_funding']}:{},...e['reward_claim_amount']!==undefined?{'reward_claim_amount':e['reward_claim_amount']}:{},...e['after_sales_mode']?{'after_sales_mode':e['after_sales_mode']}:{},...e['acceptance_mode']?{'acceptance_mode':e['acceptance_mode']}:{},...e['installment_mode']?{'installment_mode':e['installment_mode']}:{},...e['affiliate_mode']?{'affiliate_mode':e['affiliate_mode']}:{},...e['crowdfunding_mode']?{'crowdfunding_mode':e['crowdfunding_mode']}:{},...e['logistics_mode']?{'logistics_mode':e['logistics_mode']}:{},...e['sales']?.['length']?{'sales':e['sales']}:{},...e['fee_overrides']??{}},n={};Object['assign'](n,e['guard_resolutions']??{});const o=compileTemplate(j,m,{'nameBase':a['name_base']??j['id'],'intent':e['intent_text'],'guardResolutions':n,'buildTimeMs':Date['now'](),...e['supply_chain']!==undefined&&e['supply_chain']['length']>0x0?{'supplyChain':e['supply_chain']}:{}}),p=reflux(o['plan']),q=p['plan'],r=p['audit'],s=auditScore(r),t=planBlueprint(q,g,i['map'](U=>U['id'])),u=o['blockers']['map'](U=>({'module':'template','missing_constraints':[U['code']],'fix':U['detail']})),w=derivePlanSatisfiedConstraints(t,g),x={'paymentModel':e['payment_override']?.['model'],'trustArbitration':e['trust_override']?.['arbitration'],'trustRefundPolicy':e['trust_override']?.['refundPolicy'],'proofsOfDelivery':e['deliverables']?.['map'](U=>U['proofOfDelivery']),'allocationCount':e['payment_override']?.['allocation']?.['length']},y=i['map'](U=>{const V=capabilityIntentEvidence(U,e['intent_text'],x);return checkCapabilityConstraints(U,w,{'evidenceMatched':h||V['matched'],'evidence':V});}),z=j['compensation_fund_policy']==='forbidden',A=deriveDeployTimeChecks(t,z),B=derivePostDeploySteps(t,z,q['steps']['some'](U=>U['op']==='configure'&&U['id']==='service_compensation'&&U['method']==='compensation_fund_add')),C=t['edges']['some'](U=>U['relation']==='has_order_allocators')?recipientDesignGuidance()['map'](U=>({'id':U['id'],'move_recipient':U['move_recipient'],'semantics':U['semantics'],'required_constraints':U['required_constraints'],'finding_if_unmet':U['finding_if_unmet']})):undefined,D=r['findings']['filter'](U=>U['level']==='critical'||U['level']==='high')['map'](U=>({'module':'audit','missing_constraints':[U['rule_id']],'fix':U['title']+'\x20—\x20'+(U['mitigation']??U['description'])})),E=[{'re':/allocat|refund|recover|claimed_by|settle|escrow/i,'scene':'service_order_allocators_guard'},{'re':/\bbuy\b|purchase|allowlist|blocklist/i,'scene':'service_buy_guard'},{'re':/reward/i,'scene':'reward_claim'},{'re':/write_guard|repository_write/i,'scene':'repository_write_guard'},{'re':/arbitrat|ruling|voting/i,'scene':'arbitration_usage_guard'},{'re':/forward|node|witness|deliver|review|cancel|expire|submission|progress/i,'scene':'machine_forward_guard'}],F=[{'re':/claimed_by\s*some\s*==\s*true/i,'tpl':'tpl_allocator_node_gate_recover'},{'re':/claimed_by\s*some\s*==\s*false|claimed_by\s*(?:is\s+)?none|\brefund|\bcancel/i,'tpl':'tpl_allocator_node_gate_refund'},{'re':/claimed_by\s*some|\brecover|\baward/i,'tpl':'tpl_allocator_node_gate_recover'}],G=[{'host':'machine','re':/pattern\.time_lock_progress/i,'tpl':'tpl_time_lock_progress'},{'host':'machine','re':/pattern\.time_window_upper_bound/i,'tpl':'tpl_time_window_upper'},{'host':'reward','re':/pattern\./i,'tpl':'tpl_reward_one_time_claim'}],H=(U,V,W,X,Y)=>{let Z;const a0=/tpl_[a-z0-9_]+/['exec'](U+'\x20'+V),a1=X==='machine'||X==='machine_forward'?'machine_forward_guard':X==='reward'?'reward_claim':X==='repository'?'repository_write_guard':X==='arbitration'?'arbitration_usage_guard':undefined;if(a0!==null){const a6=GUARD_TEMPLATES['find'](a7=>a7['id']===a0[0x0])?.['scene_id'];a6!==undefined&&(a1===undefined||a6===a1||a6==='service_order_allocators_guard'&&X!=='reward')&&(Z=a6);}Z===undefined&&X!=='reward'&&!G['some'](a7=>a7['host']===(X==='machine_forward'?'machine':X)&&a7['re']['test'](U))&&/\ballocators?\b|claimed_by|guard_identifier|order_allocators/i['test'](V)&&(Z='service_order_allocators_guard');if(Z===undefined){if(a1!==undefined)Z=a1;else{const a7=E['find'](a8=>a8['re']['test'](U+'\x20'+V));Z=a7?.['scene'];}}if(Z===undefined)return undefined;const a2=getTemplatesByScene(Z);let a3=W!==undefined&&a2['some'](a8=>a8['applicable_industries']['includes'](W))?a2['filter'](a8=>a8['applicable_industries']['includes'](W)):a2;if(/\btime[_-]?lock|\bwindow|\btimeout|\bduration|\bdeadline|\bdays?\b|\bclock|\bdelay/i['test'](U+'\x20'+V)){const a8=a3['filter'](a9=>JSON['stringify'](a9['example_root']??{})['toLowerCase']()['includes']('clock'));if(a8['length']===0x0)return undefined;a3=a8;}if(Y['length']>0x0){const a9=a0!==null?a3['find'](ab=>ab['id']===a0[0x0]):undefined,aa=a3['filter'](ab=>{const ac=[];if(ab['example_root']!==undefined){const ad=JSON['stringify'](ab['example_root']);for(const ae of ad['matchAll'](/"query":"([^"]+)"/g))ac['push'](ae[0x1]);if(ad['includes']('\x22type\x22:\x22query_progress_history_time\x22'))ac['push']('progress.history.time');if(ad['includes']('\x22type\x22:\x22query_progress_history_find\x22'))ac['push']('progress.history.find');}return ac['some'](af=>Y['some'](ag=>af===ag||af['startsWith'](ag)||ag['startsWith'](af)));});if(a9!==undefined&&!aa['includes'](a9))aa['push'](a9);if(aa['length']===0x0)return undefined;a3=aa;}const a4=X==='machine_forward'?'machine':X,a5=G['find'](ab=>ab['host']===a4&&ab['re']['test'](U+'\x20'+V)&&a3['some'](ac=>ac['id']===ab['tpl']));a5!==undefined&&(a3=[...a3]['sort']((ab,ac)=>(ab['id']===a5['tpl']?0x0:0x1)-(ac['id']===a5['tpl']?0x0:0x1)));if(Z==='service_order_allocators_guard'){const ab=F['find'](ac=>ac['re']['test'](U+'\x20'+V));ab!==undefined&&(a3=[...a3]['sort']((ac,ad)=>(ac['id']===ab['tpl']?0x0:0x1)-(ad['id']===ab['tpl']?0x0:0x1)));}return a3['slice'](0x0,0x3)['map'](ac=>({'template_id':ac['id'],'name':ac['name'],'parameters':ac['parameters']['map'](ad=>({'name':ad['name'],'required':ad['required'],...ad['default']!==undefined?{'default':ad['default']}:{},'description':ad['description']}))}));},I=[],J=o['unresolved']['map'](U=>{const V=getGuardDesignPattern(U['template_id']),W=H(U['template_id'],U['purpose'],j?.['industry'],U['host'],V?.['key_queries']??[]),X=new Set((j?.['machine_shape']??[])['flatMap'](a6=>(a6['from']??[])['map'](a7=>typeof a7==='string'?undefined:a7['guard_key'])['filter'](a7=>typeof a7==='string'))),Y=new Map((j?.['allocator']['rows']??[])['filter'](a6=>typeof a6['guard_key']==='string')['map'](a6=>[a6['guard_key'],a6])),Z=Y['get'](U['key']),a0=Z!==undefined&&!X['has'](U['key']),a1=!X['has'](U['key'])&&!Y['has'](U['key'])&&U['policy']===undefined&&U['host']!=='reward'&&!(U['host']==='service'&&U['key']==='buy'),a2=U['host']==='service'&&U['key']==='buy';if(!a1&&!a2)I['push'](U['key']);const a3=U['key']['toLowerCase'](),a4=(U['purpose']??'')['toLowerCase'](),a5=/recover|award/['test'](a3)||!/refund/['test'](a3)&&/recover|award/['test'](a4)?'NODE\x20GATE\x20REQUIRED\x20(the\x20sketch\x20above\x20omits\x20it):\x20this\x20recovery\x20rail\x20is\x20a\x20terminal-node-gated\x20sweep\x20—\x20resolve\x20the\x20gate\x20to\x20fire\x20only\x20when\x20the\x20order\x20has\x20reached\x20the\x20recovery\x20terminal\x20nodes\x20(tpl_allocator_node_gate_recover\x20family\x20carries\x20the\x20node-gate\x20slot\x20set;\x20NEVER\x20slot\x20254).\x20NEVER\x20add\x20an\x20order.claimed_by\x20leg:\x20fund\x20rails\x20never\x20read\x20the\x20claimed_by\x20axis\x20(decision\x2011,\x20R-FUND-RAIL-CLAIMED-BY\x20/\x20RAIL_CLAIMED_BY_LEG\x20critical).':/refund/['test'](a3)||!/recover|award/['test'](a3)&&/refund/['test'](a4)?'NODE\x20GATE\x20REQUIRED\x20(the\x20sketch\x20above\x20omits\x20it):\x20this\x20refund\x20rail\x20may\x20only\x20fire\x20at\x20its\x20refund\x20terminal\x20node\x20—\x20resolve\x20the\x20gate\x20against\x20order\x20node\x20state,\x20never\x20against\x20order.claimed_by\x20(fund\x20rails\x20NEVER\x20read\x20the\x20claimed_by\x20axis;\x20decision\x2011,\x20R-FUND-RAIL-CLAIMED-BY\x20/\x20RAIL_CLAIMED_BY_LEG\x20critical).\x20The\x20arbitration\x20award\x20is\x20the\x20indemnity\x20track\x27s\x20separate\x20commercial\x20payout\x20—\x20any\x20refund/award\x20overlap\x20is\x20legal\x20and\x20disclosed\x20at\x20the\x20MCP\x20dual-payout\x20confirmation\x20gate.':undefined;return{'key':U['key'],'template_id':U['template_id'],'host':U['host'],'purpose':U['purpose'],'bound':!a1&&!a2,...V?.['logic_summary']?{'logic_summary':V['logic_summary']}:{},...a5?{'logic_summary_note':a5}:{},...V?.['key_queries']?.['length']?{'key_queries':V['key_queries']}:{},...W!==undefined&&W['length']>0x0?{'suggested_templates':W}:{},'how_to_resolve':'guide_confirm.guard_resolutions[\x27'+U['key']+'\x27]\x20=\x20{\x20kind:\x20\x27inline\x27,\x20table,\x20root\x20}\x20(a\x20resolved\x20Guard),\x20'+'or\x20{\x20kind:\x20\x27template\x27,\x20template_id:\x20\x27tpl_*\x27,\x20params\x20}\x20when\x20a\x20guard\x20template\x20matches\x20this\x20design'+(W!==undefined&&W['length']>0x0?'\x20(suggested_templates\x20below\x20list\x20the\x20matching\x20executable\x20forms\x20and\x20their\x20parameters)':'.')+(U['host']==='machine'&&!a0?'\x20MACHINE-HOST\x20REQUIREMENT:\x20the\x20inline\x20table\x20MUST\x20declare\x20the\x20protocol\x20task-binding\x20slot\x20'+'{\x20identifier:\x20254,\x20b_submission:\x20true,\x20value_type:\x20\x22Address\x22\x20}\x20—\x20the\x20forward\x27s\x20passport\x20only\x20emits\x20'+'DECLARED\x20slots,\x20so\x20a\x20machine-forward\x20guard\x20without\x20this\x20row\x20aborts\x20EVERY\x20order-bound\x20forward\x20'+'it\x20gates\x20(code\x2011)\x20and\x20the\x20pre-publish\x20gate\x20blocks\x20the\x20Machine\x20publish.':'')+(a0?'\x20ALLOCATOR-RAIL\x20NOTE:\x20this\x20design\x20gates\x20an\x20allocator\x20rail\x20(not\x20a\x20machine\x20forward)\x20—\x20do\x20NOT\x20add\x20the\x20'+'254\x20task-binding\x20slot:\x20a\x20254\x20declaration\x20arms\x20once-per-order\x20replay\x20protection\x20at\x20alloc\x20time\x20'+'(allocation\x20ONCE_FOR_OBJECT)\x20and\x20permanently\x20blocks\x20multi-fire\x20rails\x20(a\x20second\x20release\x20aborts\x20'+'E_ONCE_TRIGGERED).\x20The\x20kernel\x20injects\x20254\x20ONLY\x20for\x20GuardIdentifier(254)-recipient\x20rails.'+(Z['recipient']==='guard_identifier'&&Z['recipient_key']!=='254'?'\x20This\x20rail\x27s\x20recipient\x20is\x20GuardIdentifier('+(Z['recipient_key']??'0')+')\x20—\x20the\x20inline\x20table\x20MUST\x20'+('declare\x20slot\x20'+(Z['recipient_key']??'0')+'\x20as\x20an\x20Address\x20submission\x20instead\x20(N-K21:\x20the\x20passport\x20')+'submits\x20the\x20ORDER\x20address\x20into\x20it;\x20an\x20undeclared\x20slot\x20makes\x20the\x20rail\x20unexecutable).':''):'')+(a1?'\x20ADVISORY\x20DESIGN\x20(run75747\x20F-38):\x20nothing\x20in\x20this\x20archetype\x20binds\x20this\x20key\x20—\x20no\x20machine\x20edge,\x20allocator\x20'+'rail,\x20repository\x20policy,\x20or\x20service\x20mount.\x20If\x20this\x20design\x20does\x20not\x20apply\x20to\x20your\x20shop\x20you\x20may\x20resolve\x20'+'it\x20with\x20{\x20kind:\x20\x27omit\x27\x20}\x20instead\x20of\x20building\x20a\x20Guard\x20no\x20one\x20consumes:\x20the\x20design\x20leaves\x20'+'pending_guard_designs,\x20no\x20Guard\x20object\x20is\x20created,\x20and\x20the\x20decision\x20is\x20recorded\x20in\x20the\x20build\x27s\x20'+'warnings.\x20An\x20omit\x20of\x20a\x20BOUND\x20design\x20is\x20refused\x20(GUARD_OMIT_UNSUPPORTED).':'')};}),K=u['length']>0x0||r['blocking'],L={'expiredTerminal':(j['machine_shape']??[])['some'](U=>/expire|deadline|timeout/i['test'](String(U?.['name']??'')))},M=checkGameTheoryConstraints(t,g,L),N=[];for(const U of requirementCoverage(e['intent_text'],j)){if(U['status']==='mapped')continue;N['push']({'id':U['family'],'label':U['label'],'severity':U['status']==='blocker'&&U['family']==='fulfillment'?'critical':'medium','message':'Intent\x20promises\x20\x27'+U['label']+'\x27\x20(stated:\x20\x22'+U['evidence']+'\x22)\x20but\x20the\x20matched\x20template\x20does\x20not\x20carry\x20it:\x20'+U['note'],'fix':U['note']});}for(const V of y){if(V['adopted']||V['evidence_matched']!==![])continue;N['push']({'id':'module_'+V['capability'],'label':V['capability'],'severity':'info','message':'Module\x20\x27'+V['capability']+'\x27\x20rides\x20score\x20alone\x20(no\x20intent\x20evidence):\x20its\x20objects\x20ARE\x20included\x20in\x20this\x20build\x20—\x20an\x20UNCONFIRMED\x20adoption.','fix':'Confirm\x20via\x20guide_state.adopted_module_ids,\x20answer\x20the\x20structured\x20payment/trust\x20questions,\x20or\x20rebuild\x20with\x20an\x20adoption\x20list\x20that\x20omits\x20it.'});}const O=assessWorkflowDesign(t,{'gaps':N}),P=buildCreationPlan(t),Q=[...new Set(q['steps']['filter'](W=>typeof W['account']==='string')['map'](W=>W['account']))]['sort'](),R=[...collectLateMarks(q)]['sort'](),S=j?{'name':j['id'],'display_name':j['variant']+'\x20archetype\x20('+j['industry']+')','source':a['template_override']?'custom':'builtin','risk_appetite':'medium','key_risk':j['key_risk'],'machine_shape':j['machine_shape']['map'](W=>({'name':W['name'],'role':W['role'],...W['operator']?{'operator':W['operator']}:{},...W['semantic_role']?{'semantic_role':W['semantic_role']}:{}})),'guards':j['guards']['map'](W=>({'template_id':W['template_id'],'host':W['host'],'purpose':W['purpose']})),'allocator':j['allocator'],'risk_constraints':{},'build_notes':j['build_notes']??[],...j['time_anchors']?{'time_anchors':j['time_anchors']}:{}}:undefined;return{'action':'merchant_guide','current_step':K?0x9:0xa,'step_name':K?'Harness\x20Check\x20(issues\x20found)':'Submission\x20Plan\x20Ready','guide_state':{...e,'adopted_module_ids':i['map'](W=>W['id'])},'intent':{'intent_type':g['intent'],'industry':g['industry'],'roles':g['roles'],'deliverables':g['deliverables'],'payment':g['payment'],'trust':g['trust']},'adopted_modules':i['map'](W=>({'id':W['id'],'name':W['name'],'description':W['description'],'requires_keeper':W['requiresKeeper'],'keeper_hint':W['keeperHint'],'user_protections':W['userProtections'],'merchant_obligations':W['merchantObligations']})),'mode_prior':S,...l['length']>0x0?{'user_input_questions':l,'user_input_note':'Collect\x20each\x20answer\x20and\x20pass\x20it\x20back\x20as\x20guide_state.fee_overrides[\x27<param_key>\x27]\x20on\x20the\x20next\x20merchant_guide\x20call;\x20unanswered\x20questions\x20keep\x20the\x20template\x20default.'}:{},...S?.['time_anchors']?{'time_anchor_instructions':Object['entries'](S['time_anchors'])['map'](([W,X])=>{const Y=X['startsWith']('order.time')?'\x20(order-creation\x20time\x20—\x20PRE-checkout\x20branches\x20only;\x20a\x20post-checkout\x20window\x20anchored\x20here\x20is\x20unreachable)':X['startsWith']('progress.current_time')?'\x20(entry\x20time\x20of\x20the\x20window\x27s\x20source\x20node\x20—\x20witness-derived\x20via\x20OrderProgress,\x20one\x20Guard\x20serves\x20every\x20order)':X['startsWith']('absolute_date')?'\x20(per-order\x20instance\x20Guard\x20—\x20the\x20absolute\x20date\x20differs\x20per\x20booking)':'';return'Time\x20windows\x20for\x20\x27'+W+'\x27\x20anchor\x20to\x20'+X+Y;})}:{},'blueprint':{'nodes':t['nodes']['map'](W=>({'id':W['id'],'type':W['type'],'purpose':W['purpose']})),'edges':t['edges']['map'](W=>({'from':W['from'],'to':W['to'],'relation':W['relation'],'required':W['required']}))},'evaluation_preview':{'estimatedRiskScore':s,'estimatedCompletenessScore':Math['min'](0x64,0x1e+i['length']*0x8),'keyRisks':r['findings']['filter'](W=>W['level']==='critical'||W['level']==='high')['map'](W=>W['title']),'strengths':r['findings']['filter'](W=>W['level']==='info')['map'](W=>W['title']),'moduleBoosts':{}},'graph_validation':{'valid':r['issues']['length']===0x0,'hard_violations':r['issues']['map'](W=>({'id':W['code'],'description':W['detail'],'fix':'Fix\x20the\x20Plan\x20structure'})),'soft_notes':r['findings']['filter'](W=>W['level']==='medium'||W['level']==='low')['map'](W=>({'id':W['rule_id'],'description':W['title']}))},'harness_check':{'module_constraints':y['map'](W=>{const X=W['capability']==='discount_lifecycle'&&W['adopted']?'ADOPTION-BASED\x20satisfaction\x20(disclosure\x20obligations\x20accepted\x20with\x20module\x20adoption),\x20NOT\x20plan\x20structure:\x20creation_plan\x20intentionally\x20carries\x20no\x20Discount/SKU\x20nodes\x20—\x20they\x20are\x20minted\x20in\x20merchant\x20post-deploy\x20steps\x20and\x20verified\x20on-chain\x20after\x20deploy\x20(query\x20the\x20minted\x20Service.discount).\x20Reward\x20FUNDING\x20rides\x20review_mode\x20compile\x20emission,\x20BUT\x20the\x20reward\x20claim\x20GUARD\x20SPEC\x20must\x20still\x20be\x20declared\x20in\x20the\x20plan\x27s\x20guards[]\x20(host:\x27reward\x27)\x20—\x20compile\x20emits\x20the\x20rail\x20only\x20from\x20that\x20spec,\x20and\x20REVIEW_REWARD_GUARD_MISSING\x20hard-blocks\x20publish\x20when\x20it\x20is\x20omitted\x20(G-02,\x20onlyfans-mn\x20261019:\x20the\x20old\x20prose\x20denied\x20the\x20guard\x20spec\x20and\x20deadlocked\x20every\x20reward\x20publish).':W['reason'],Y=W['evidence_matched']===![]?W['reason']:X;return{'module':W['capability'],'plan_satisfied':W['adopted'],'missing':W['missingConstraints'],'reason':Y,'findings':W['findings'],'evidence_matched':W['evidence_matched']};}),'blocking_issues':[...u['map'](W=>({'module':W['module'],'missing_constraints':W['missing_constraints'],'fix':W['fix']})),...D],'module_gaps':y['filter'](W=>!W['adopted'])['map'](W=>({'module':W['capability'],'missing_constraints':W['missingConstraints'],'fix':W['reason']})),'deploy_time_checks':A,'recipient_design_guidance':C},'game_theory':{'summary':M['summary'],'coverage':M['coveredCount']+'/'+M['totalCount'],'exposed_scenarios':M['exposedScenarios'],'wow_alignments':M['wowAlignments'],'scenarios':M['results']['map'](W=>({'scenario':W['scenario'],'covered':W['covered'],'conflict':W['conflict'],'user_protection':W['userProtection'],'evaluation_metric':W['evaluationMetric'],'recommendation':W['recommendation']}))},'workflow_design_assessment':{'score':O['score'],'summary':O['summary'],'findings':O['findings']['map'](W=>({'kind':W['kind'],'severity':W['severity'],'message':W['message'],'fix':W['fix']})),'checks':O['checks']['map'](W=>({'id':W['id'],'dimension':W['dimension'],'passed':W['passed'],'severity':W['severity'],'message':W['message'],'fix':W['fix']}))},'creation_plan':P,'post_deploy_steps':B,...o['supplyChain']!==undefined?{'supply_chain':o['supplyChain']['map'](W=>({'steps':W['steps']['map'](X=>X['id']),'inputs':W['inputs'],'primitives':W['primitives'],'notes':W['notes'],...W['handoff']!==undefined?{'handoff':W['handoff']}:{}}))}:{},'mandatory_disclosures':['PII\x20discipline\x20(rex5\x20B-57):\x20never\x20write\x20personal\x20data\x20(phone,\x20email,\x20exact\x20unit\x20address)\x20into\x20public\x20on-chain\x20fields\x20—\x20Contact\x20description/location/IM\x20entries,\x20repository\x20rows,\x20progress\x20messages\x20and\x20WIP\x20text\x20are\x20all\x20public.\x20Exchange\x20PII\x20over\x20the\x20encrypted\x20Messenger\x20and\x20keep\x20only\x20WTS\x20proofs\x20on\x20chain;\x20the\x20local\x20harness\x20store\x20is\x20non-private\x20too\x20(cache.db\x20holds\x20messenger\x20plaintext\x20and\x20LocalInfo\x20entries\x20unencrypted\x20on\x20disk,\x20readable\x20by\x20any\x20session\x20sharing\x20the\x20keystore).','Trust-claim\x20prose\x20is\x20not\x20a\x20chain\x20anchor\x20(rex5\x20T-31):\x20any\x20compensation-fund\x20or\x20protection\x20figure\x20quoted\x20in\x20the\x20service\x20description\x20is\x20free\x20text\x20—\x20awards\x20shrink\x20the\x20live\x20fund\x20in\x20place\x20(the\x20quoted\x20number\x20silently\x20goes\x20stale)\x20and\x20the\x20per-order\x20covered\x20ceiling\x20is\x20fund/3\x20(MAX_INDEMNITY_MULTIPLE),\x20not\x20the\x20headline.\x20Keep\x20quoted\x20numbers\x20synced\x20to\x20the\x20live\x20fund\x20balance\x20before\x20publishing\x20and\x20after\x20every\x20award.','Single-account\x20build\x20contract\x20(MN5-5R\x20decision):\x20this\x20pipeline\x20wires\x20ONLY\x20the\x20deploying\x20account\x20—\x20the\x20permission\x20layer\x27s\x20admin\x20pass-through\x20means\x20a\x20single-account\x20build\x20needs\x20zero\x20grants,\x20so\x20no\x20other\x20account\x20is\x20ever\x20granted.\x20A\x20multi-account\x20shop\x20(separate\x20keeper/staff/operator\x20accounts)\x20will\x20be\x20REFUSED\x20at\x20execution\x20time\x20(error\x20codes\x201000/1002\x20and\x20the\x20350~364\x20abort\x20family)\x20—\x20the\x20plan\x20will\x20look\x20complete\x20and\x20still\x20fail\x20on\x20first\x20non-admin\x20operation.\x20Until\x20an\x20explicit\x20account-grant\x20phase\x20ships,\x20run\x20multi-account\x20shops\x20by\x20declaring\x20the\x20limitation\x20up\x20front\x20and\x20granting\x20roles\x20manually\x20post-publish;\x20do\x20not\x20let\x20the\x20plan\x27s\x20completeness\x20imply\x20multi-account\x20readiness.'],...J['length']>0x0?{'pending_guard_designs':J}:{},...J['length']>0x0&&(q['pending_guards']?.['length']??0x0)!==J['length']?{'pending_count_note':'Two\x20counts,\x20two\x20views:\x20pending_guard_designs\x20lists\x20'+J['length']+'\x20unresolved\x20design(s)\x20(compile\x20view\x20—\x20includes\x20advisory\x20designs\x20with\x20no\x20edge/rail/policy/buy\x20mount);\x20'+('the\x20plan\x20audit\x20counts\x20'+(q['pending_guards']?.['length']??0x0)+'\x20(plan\x20view\x20—\x20site-bound\x20designs\x20only;\x20the\x20rule-pack\x20titles\x20\x22of\x20N\x20pending\x20in\x20total\x22\x20quote\x20this).\x20')+'The\x20LIST\x20is\x20the\x20resolution\x20fill\x20space;\x20the\x20audit\x20number\x20is\x20its\x20site-bound\x20subset.'}:{},'warnings':[...f['warnings'],...gasEconomicsWarnings(e['sales'],e['reward_claim_amount']),...o['omitted']['length']>0x0?['Advisory\x20guard\x20design(s)\x20omitted\x20by\x20decision\x20({kind:\x27omit\x27}):\x20'+o['omitted']['join'](',\x20')+'\x20—\x20'+'no\x20Guard\x20created,\x20nothing\x20binds\x20them\x20(run75747\x20F-38).']:[],...(o['supplyChain']??[])['flatMap']((W,X)=>W['notes']['map'](Y=>'Supply-chain\x20promise\x20#'+String(X+0x1)+':\x20'+Y))],'next_action':u['length']>0x0?'Resolve\x20the\x20blocking_issues\x20above\x20(compile\x20blockers\x20—\x20harness_check.blocking_issues\x20rows\x20with\x20module\x20\x27template\x27;\x20adjust\x20the\x20template\x20or\x20its\x20build\x20inputs),\x20then\x20call\x20merchant_guide\x20again.':r['blocking']?'The\x20plan\x20audit\x20is\x20BLOCKING\x20(see\x20harness_check.blocking_issues\x20and\x20audit.findings\x20—\x20e.g.\x20a\x20terminal\x20node\x20with\x20no\x20fund\x20exit,\x20or\x20an\x20unresolved\x20guard\x20bound\x20to\x20a\x20fund\x20path).\x20Fix\x20the\x20plan/template\x20or\x20guard\x20resolutions\x20and\x20call\x20merchant_guide\x20again;\x20do\x20NOT\x20materialize\x20this\x20plan.'+(J['length']>0x0?'\x20Pending\x20guard\x20designs:\x20'+J['length']+'\x20listed\x20in\x20pending_guard_designs\x20—\x20resolve\x20each\x20via\x20guide_confirm.guard_resolutions\x20(kind\x20\x27inline\x27\x20with\x20the\x20Guard\x20table+root,\x20kind\x20\x27template\x27\x20with\x20a\x20tpl_*\x20id,\x20or\x20{kind:\x27omit\x27}\x20for\x20advisory\x20designs\x20that\x20do\x20not\x20apply\x20to\x20this\x20shop),\x20then\x20call\x20merchant_guide\x20again.':''):I['length']>0x0?'Plan\x20is\x20structurally\x20ready,\x20but\x20'+I['length']+'\x20bound\x20guard\x20design(s)\x20('+I['map'](W=>'\x27'+W+'\x27')['join'](',\x20')+')\x20are\x20UNRESOLVED\x20(plan.pending_guard_designs)\x20—\x20do\x20NOT\x20materialize\x20yet:\x20an\x20unresolved\x20bound\x20design\x20ships\x20a\x20guard\x20the\x20executor\x20invents.\x20Resolve\x20each\x20via\x20guide_confirm.guard_resolutions\x20(kind\x20\x27inline\x27\x20with\x20the\x20Guard\x20table+root,\x20kind\x20\x27template\x27\x20with\x20a\x20tpl_*\x20id,\x20or\x20{kind:\x27omit\x27}\x20for\x20advisory\x20designs\x20that\x20do\x20not\x20apply\x20to\x20this\x20shop),\x20then\x20call\x20merchant_guide\x20again.':'Plan\x20ready.\x20Materialize\x20in\x20ONE\x20deterministic\x20call:\x20benchmark_migration\x20{action:\x27plan_execute\x27,\x20plan:\x20this\x20response\x27s\x20plan\x20object\x20verbatim'+(Q['length']>0x0?',\x20accounts:{'+Q['map'](W=>W+':\x20<its\x20controller\x20env>')['join'](',\x20')+'}':'')+('}\x20—\x20it\x20pre-flights\x20the\x20freeze\x20gate,\x20bind-audits\x20every\x20reference,\x20pre-resolves\x20local\x20marks,\x20slices\x20on\x20timeout_ms,\x20and\x20RESUMES\x20from\x20failures\x20(completed_steps\x20+\x20previous_outputs;\x20never\x20re-run\x20from\x20scratch\x20—\x20ghost\x20duplicates).\x20Then\x20run\x20post_deploy_steps\x20in\x20order\x20('+B['map'](W=>W['id'])['join'](',\x20')+').\x20WIZARD\x20CONTRACT:\x20on\x20the\x20Service\x20publish\x20call\x20(data.publish=true),\x20pass\x20this\x20exact\x20plan\x20back\x20as\x20data.creation_plan\x20—\x20the\x20publish\x20gate\x20replays\x20its\x20freeze\x20matrix\x20and\x20rejects\x20the\x20publish\x20if\x20any\x20gate\x20fails;\x20omitting\x20it\x20leaves\x20the\x20manual\x20path\x20ungated.\x20Manual\x20fallback\x20(only\x20if\x20plan_execute\x20refuses):\x20create\x20the\x20objects\x20in\x20creation_plan\x20order\x20via\x20onchain_operations,\x20then\x20run\x20post_deploy_steps\x20in\x20order.'),'plan':((()=>{const W=templateCatalogDigest(String(q['templateId']??''));return{...q,...W!==undefined?{'template_digest':W}:{},'catalog_version':BUILTIN_TEMPLATES_VERSION};})()),...R['length']>0x0?{'required_local_marks':R,'required_local_marks_note':'plan_execute\x20(the\x20default\x20materializer\x20above)\x20resolves\x20each\x20of\x20these\x20local\x20names\x20against\x20the\x20LocalMark\x20store\x20of\x20the\x20target\x20network\x20and\x20refuses\x20to\x20execute\x20while\x20any\x20is\x20unregistered.\x20'+'Register\x20them\x20BEFORE\x20executing\x20(local_mark_operation\x20add).\x20A\x20name\x20that\x20matches\x20an\x20object\x20this\x20plan\x20itself\x20creates\x20is\x20bound\x20to\x20that\x20object\x20automatically.\x20'+'A\x20recipient\x20mark\x20must\x20point\x20at\x20a\x20real\x20account\x20address:\x20an\x20empty\x20name\x20makes\x20the\x20SDK\x20substitute\x20the\x20deploying\x20account,\x20and\x20an\x20object-id\x20/\x20zero-address\x20recipient\x20is\x20transferred\x20and\x20cannot\x20be\x20retrieved.'}:{},'audit':{'issues':r['issues'],'findings':r['findings'],'blocking':r['blocking'],'score':s},'reflux':{'applied':p['applied'],'blocks':p['blocks'],'iterations':p['iterations']}};}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type IndustryTemplate } from "../../knowledge/template-loader.js";
|
|
2
|
+
import { type RequirementCoverageEntry } from "../../knowledge/requirement-families.js";
|
|
2
3
|
import type { SemanticIRDiscovery } from "../../knowledge/semantic-ir.js";
|
|
3
4
|
import type { Industry } from "../../customer/index.js";
|
|
4
5
|
export interface MigrationEntry {
|
|
@@ -35,6 +36,7 @@ export interface MigrationLog {
|
|
|
35
36
|
passed: boolean;
|
|
36
37
|
findings: string[];
|
|
37
38
|
};
|
|
39
|
+
requirement_coverage: RequirementCoverageEntry[];
|
|
38
40
|
questions?: MigrationQuestion[];
|
|
39
41
|
network: "testnet" | "mainnet" | "localnet";
|
|
40
42
|
}
|