@wowok/agent-mcp 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.js +1 -1
- package/dist/config/runtime.js +1 -238
- package/dist/customer/customer-advice.js +1 -130
- package/dist/customer/index.js +1 -11
- package/dist/customer/industry-risks.js +1 -438
- package/dist/customer/info-puzzle.js +1 -681
- package/dist/customer/order-monitor.js +1 -328
- package/dist/customer/order-strategy.js +1 -373
- package/dist/customer/post-purchase.js +1 -351
- package/dist/customer/preorder-compare.js +1 -34
- package/dist/customer/reminder-system.js +1 -316
- package/dist/customer/risk-assessment.d.ts +5 -1
- package/dist/customer/risk-assessment.js +1 -397
- package/dist/customer/types.js +1 -13
- package/dist/customer/user-preferences.js +1 -460
- package/dist/evaluation/arbitration-game.d.ts +23 -0
- package/dist/evaluation/arbitration-game.js +1 -0
- package/dist/evaluation/builtins/demand-match.d.ts +15 -0
- package/dist/evaluation/builtins/demand-match.js +1 -0
- package/dist/evaluation/builtins/index.d.ts +3 -0
- package/dist/evaluation/builtins/index.js +1 -0
- package/dist/evaluation/builtins/service-risk.d.ts +6 -0
- package/dist/evaluation/builtins/service-risk.js +1 -0
- package/dist/evaluation/capability.d.ts +50 -0
- package/dist/evaluation/capability.js +1 -0
- package/dist/evaluation/composer.d.ts +13 -0
- package/dist/evaluation/composer.js +1 -0
- package/dist/evaluation/engine.d.ts +18 -0
- package/dist/evaluation/engine.js +1 -0
- package/dist/evaluation/extract.d.ts +30 -0
- package/dist/evaluation/extract.js +1 -0
- package/dist/evaluation/game-strategy.d.ts +27 -0
- package/dist/evaluation/game-strategy.js +1 -0
- package/dist/evaluation/gap.d.ts +2 -0
- package/dist/evaluation/gap.js +1 -0
- package/dist/evaluation/index.d.ts +12 -0
- package/dist/evaluation/index.js +1 -0
- package/dist/evaluation/node-game.d.ts +62 -0
- package/dist/evaluation/node-game.js +1 -0
- package/dist/evaluation/region.d.ts +10 -0
- package/dist/evaluation/region.js +1 -0
- package/dist/evaluation/types.d.ts +77 -0
- package/dist/evaluation/types.js +1 -0
- package/dist/evaluation/user-injection.d.ts +6 -0
- package/dist/evaluation/user-injection.js +1 -0
- package/dist/examples/education-contact-create.json +40 -0
- package/dist/examples/freelance-contact-create.json +40 -0
- package/dist/examples/insurance-machine-create.json +1 -1
- package/dist/examples/insurance-service-allocators.json +1 -1
- package/dist/examples/machine-publish.json +1 -1
- package/dist/examples/rental-ziroom-service-create.json +1 -1
- package/dist/examples/retail-adv-guard-messenger-proof-create.json +1 -1
- package/dist/examples/retail-myshop-service-create.json +1 -1
- package/dist/examples/retail-myshop-service-customer-required.json +1 -1
- package/dist/examples/subscription-contact-create.json +40 -0
- package/dist/examples/threebody-machine-create.json +1 -1
- package/dist/examples/travel-machine-create.json +1 -1
- package/dist/examples/travel-service-create.json +1 -1
- package/dist/experience/experience-reuse.js +1 -103
- package/dist/experience/index.js +1 -5
- package/dist/experience/intent-distill.js +1 -83
- package/dist/experience/realtime-feedback.js +1 -94
- package/dist/experience/types.js +1 -1
- package/dist/experience/user-profile.js +1 -171
- package/dist/extensions/business-modules.js +1 -287
- package/dist/extensions/capability-manifest.js +1 -781
- package/dist/extensions/constraint-registry.js +1 -198
- package/dist/extensions/index.js +1 -6
- package/dist/extensions/metric-registry.js +1 -257
- package/dist/extensions/mode-evaluator.js +1 -170
- package/dist/extensions/modes.js +1 -499
- package/dist/extensions/registry.js +1 -717
- package/dist/extensions/types.js +1 -1
- package/dist/harness/auto-escalation.js +1 -68
- package/dist/harness/checkpoint.js +1 -129
- package/dist/harness/index.js +1 -78
- package/dist/harness/plan.js +1 -276
- package/dist/harness/recover.js +1 -139
- package/dist/harness/types.js +1 -1
- package/dist/harness/verify.js +1 -237
- package/dist/index.js +1 -273
- package/dist/intent/enrich.d.ts +1 -0
- package/dist/intent/enrich.js +1 -0
- package/dist/intent/index.d.ts +23 -0
- package/dist/intent/index.js +1 -0
- package/dist/intent/matcher.d.ts +2 -0
- package/dist/intent/matcher.js +1 -0
- package/dist/intent/store.d.ts +19 -0
- package/dist/intent/store.js +1 -0
- package/dist/intent/types.d.ts +33 -0
- package/dist/intent/types.js +1 -0
- package/dist/knowledge/acquisition-flywheel.js +1 -192
- package/dist/knowledge/allocation-confirm.js +1 -534
- package/dist/knowledge/allocation-context.js +1 -249
- package/dist/knowledge/allocation-ledger.js +1 -463
- package/dist/knowledge/allocation-puzzle.js +1 -298
- package/dist/knowledge/allocation-risk.js +1 -568
- package/dist/knowledge/allocation-templates.js +1 -970
- package/dist/knowledge/allocation-translation.js +1 -585
- package/dist/knowledge/arb-risk.js +1 -210
- package/dist/knowledge/arbitration-confirm.js +1 -559
- package/dist/knowledge/arbitration-context.js +1 -505
- package/dist/knowledge/arbitration-ledger.js +1 -521
- package/dist/knowledge/arbitration-puzzle.js +1 -304
- package/dist/knowledge/arbitration-risk.js +1 -433
- package/dist/knowledge/arbitration-templates.js +1 -276
- package/dist/knowledge/arbitration-translation.js +1 -487
- package/dist/knowledge/arbitration-trust.js +1 -117
- package/dist/knowledge/audit-rules.js +1 -141
- package/dist/knowledge/bridge-risk.js +1 -263
- package/dist/knowledge/contact-risk.js +1 -200
- package/dist/knowledge/contact-templates.d.ts +27 -0
- package/dist/knowledge/contact-templates.js +1 -0
- package/dist/knowledge/demand-confirm.js +1 -206
- package/dist/knowledge/demand-matching.js +1 -132
- package/dist/knowledge/demand-risk.js +1 -240
- package/dist/knowledge/demand-translation.js +1 -354
- package/dist/knowledge/deployment-scanner.js +1 -823
- package/dist/knowledge/dynamic-pricing.js +1 -87
- package/dist/knowledge/examples-scanner-cli.js +1 -26
- package/dist/knowledge/examples-scanner.js +1 -825
- package/dist/knowledge/flywheel-loop.js +1 -404
- package/dist/knowledge/fund-layer.js +1 -973
- package/dist/knowledge/glossary.js +1 -211
- package/dist/knowledge/guard-confirm.js +1 -406
- package/dist/knowledge/guard-context.js +1 -287
- package/dist/knowledge/guard-design-patterns.js +1 -360
- package/dist/knowledge/guard-ledger.js +1 -260
- package/dist/knowledge/guard-lint.js +1 -670
- package/dist/knowledge/guard-migration.js +1 -228
- package/dist/knowledge/guard-puzzle.js +1 -805
- package/dist/knowledge/guard-render.js +1 -700
- package/dist/knowledge/guard-risk.js +1 -1879
- package/dist/knowledge/guard-submission-prompt.js +1 -171
- package/dist/knowledge/guard-templates.js +1 -1105
- package/dist/knowledge/guard-translation.js +1 -1119
- package/dist/knowledge/index.js +1 -436
- package/dist/knowledge/industry-evolution.js +1 -323
- package/dist/knowledge/industry-generalizer.js +1 -381
- package/dist/knowledge/industry-registry.js +1 -174
- package/dist/knowledge/intent-metrics.d.ts +4 -3
- package/dist/knowledge/intent-metrics.js +1 -566
- package/dist/knowledge/machine-confirm.js +1 -559
- package/dist/knowledge/machine-context.js +1 -833
- package/dist/knowledge/machine-ledger.js +1 -338
- package/dist/knowledge/machine-puzzle.js +1 -494
- package/dist/knowledge/machine-render.js +1 -565
- package/dist/knowledge/machine-risk.js +1 -670
- package/dist/knowledge/machine-templates.js +1 -1597
- package/dist/knowledge/machine-topology.js +1 -234
- package/dist/knowledge/machine-translation.js +1 -513
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
- package/dist/knowledge/mcp-schema-audit.d.ts +1 -1
- package/dist/knowledge/mcp-schema-audit.js +1 -773
- package/dist/knowledge/onchain-constants.js +1 -35
- package/dist/knowledge/order-confirm.js +1 -573
- package/dist/knowledge/order-context.js +1 -390
- package/dist/knowledge/order-ledger.js +1 -341
- package/dist/knowledge/order-puzzle.js +1 -255
- package/dist/knowledge/order-risk.js +1 -653
- package/dist/knowledge/order-templates.js +1 -368
- package/dist/knowledge/order-translation.js +1 -550
- package/dist/knowledge/overrides-loader.js +1 -65
- package/dist/knowledge/passport-confirm.js +1 -531
- package/dist/knowledge/passport-context.js +1 -306
- package/dist/knowledge/passport-ledger.js +1 -282
- package/dist/knowledge/passport-puzzle.js +1 -333
- package/dist/knowledge/passport-risk.js +1 -450
- package/dist/knowledge/passport-templates.js +1 -568
- package/dist/knowledge/passport-translation.js +1 -516
- package/dist/knowledge/payment-risk.js +1 -249
- package/dist/knowledge/permission-confirm.js +1 -426
- package/dist/knowledge/permission-context.js +1 -224
- package/dist/knowledge/permission-ledger.js +1 -403
- package/dist/knowledge/permission-puzzle.js +1 -173
- package/dist/knowledge/permission-risk.js +1 -411
- package/dist/knowledge/permission-templates.js +1 -234
- package/dist/knowledge/permission-translation.js +1 -350
- package/dist/knowledge/personal-risk.js +1 -212
- package/dist/knowledge/process-model.js +1 -160
- package/dist/knowledge/progress-confirm.js +1 -456
- package/dist/knowledge/progress-context.js +1 -452
- package/dist/knowledge/progress-ledger.js +1 -330
- package/dist/knowledge/progress-puzzle.js +1 -219
- package/dist/knowledge/progress-risk.js +1 -461
- package/dist/knowledge/progress-templates.js +1 -228
- package/dist/knowledge/progress-translation.js +1 -405
- package/dist/knowledge/proof-confirm.js +1 -187
- package/dist/knowledge/proof-risk.js +1 -207
- package/dist/knowledge/proof-translation.js +1 -283
- package/dist/knowledge/registrar-risk.js +1 -217
- package/dist/knowledge/repository-confirm.js +1 -286
- package/dist/knowledge/repository-risk.js +1 -373
- package/dist/knowledge/repository-translation.js +1 -445
- package/dist/knowledge/reputation-rules.js +1 -99
- package/dist/knowledge/resource-risk.js +1 -157
- package/dist/knowledge/reward-confirm.js +1 -526
- package/dist/knowledge/reward-context.js +1 -504
- package/dist/knowledge/reward-ledger.js +1 -502
- package/dist/knowledge/reward-puzzle.js +1 -300
- package/dist/knowledge/reward-risk.js +1 -627
- package/dist/knowledge/reward-templates.js +1 -197
- package/dist/knowledge/reward-translation.js +1 -501
- package/dist/knowledge/safety-rules.js +1 -404
- package/dist/knowledge/scenario-modes.js +1 -321
- package/dist/knowledge/service-confirm.js +1 -807
- package/dist/knowledge/service-context.js +1 -403
- package/dist/knowledge/service-ledger.js +1 -609
- package/dist/knowledge/service-puzzle.js +1 -236
- package/dist/knowledge/service-risk.js +1 -615
- package/dist/knowledge/service-templates.js +1 -456
- package/dist/knowledge/service-translation.js +1 -622
- package/dist/knowledge/template-registry.d.ts +1 -1
- package/dist/knowledge/template-registry.js +1 -341
- package/dist/knowledge/tool-constraints.js +1 -195
- package/dist/knowledge/tools-reference.js +1 -155
- package/dist/knowledge/treasury-confirm.js +1 -512
- package/dist/knowledge/treasury-context.js +1 -363
- package/dist/knowledge/treasury-ledger.js +1 -300
- package/dist/knowledge/treasury-puzzle.js +1 -216
- package/dist/knowledge/treasury-risk.js +1 -440
- package/dist/knowledge/treasury-templates.js +1 -358
- package/dist/knowledge/treasury-translation.js +1 -498
- package/dist/knowledge/trust-metrics.js +1 -198
- package/dist/knowledge/util-risk.js +1 -135
- package/dist/loop-engineering/aggregate.js +1 -132
- package/dist/loop-engineering/context-collect.js +1 -83
- package/dist/loop-engineering/diagnose.js +1 -273
- package/dist/loop-engineering/improve.js +1 -405
- package/dist/loop-engineering/index.js +1 -4
- package/dist/loop-engineering/pipeline.js +1 -56
- package/dist/mode-market/index.js +1 -3
- package/dist/mode-market/registry.js +1 -124
- package/dist/mode-market/review.js +1 -214
- package/dist/mode-market/submission.js +1 -85
- package/dist/participation/collaborator-interest.d.ts +23 -0
- package/dist/participation/collaborator-interest.js +1 -0
- package/dist/participation/customer-interest.d.ts +25 -0
- package/dist/participation/customer-interest.js +1 -0
- package/dist/participation/merchant-interest.js +1 -100
- package/dist/participation/radar-core.d.ts +13 -3
- package/dist/participation/radar-core.js +1 -269
- package/dist/participation/supplier-interest.d.ts +25 -0
- package/dist/participation/supplier-interest.js +1 -0
- package/dist/persona/analyzer.d.ts +16 -0
- package/dist/persona/analyzer.js +1 -0
- package/dist/persona/bridge.d.ts +5 -0
- package/dist/persona/bridge.js +1 -0
- package/dist/persona/defaults.d.ts +4 -0
- package/dist/persona/defaults.js +1 -0
- package/dist/persona/experience-bridge.d.ts +3 -0
- package/dist/persona/experience-bridge.js +1 -0
- package/dist/persona/index.d.ts +18 -0
- package/dist/persona/index.js +1 -0
- package/dist/persona/model.d.ts +7 -0
- package/dist/persona/model.js +1 -0
- package/dist/persona/store.d.ts +19 -0
- package/dist/persona/store.js +1 -0
- package/dist/persona/types.d.ts +45 -0
- package/dist/persona/types.js +1 -0
- package/dist/project/business-puzzle.js +1 -383
- package/dist/project/context-assembly.js +1 -254
- package/dist/project/deployment-bridge.js +1 -120
- package/dist/project/deployment-doc.js +1 -1126
- package/dist/project/edit-planner.js +1 -1342
- package/dist/project/evaluation.js +1 -2011
- package/dist/project/game-theory.js +1 -177
- package/dist/project/graph-builder.js +1 -656
- package/dist/project/graph.js +1 -340
- package/dist/project/handlers.d.ts +5 -0
- package/dist/project/handlers.js +1 -1762
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +1 -301
- package/dist/project/intent-analyzer.js +1 -149
- package/dist/project/machine-nodes.js +1 -36
- package/dist/project/merchant-guide.js +1 -264
- package/dist/project/migration.js +1 -125
- package/dist/project/mode-actions.js +1 -309
- package/dist/project/namespace.js +1 -206
- package/dist/project/participation-radar.js +1 -428
- package/dist/project/pipeline-actions.js +1 -109
- package/dist/project/project-store.js +1 -422
- package/dist/project/query.js +1 -153
- package/dist/project/reverse-mapping.d.ts +34 -0
- package/dist/project/reverse-mapping.js +1 -0
- package/dist/project/risk-aggregator.js +1 -295
- package/dist/project/rollback-policy.js +1 -290
- package/dist/project/semantic-assembler.js +1 -345
- package/dist/project/semantic-graph.js +1 -245
- package/dist/project/stage-gate.js +1 -369
- package/dist/project/substep-trace.js +1 -332
- package/dist/project/task-tracker.js +1 -78
- package/dist/role/derivation.d.ts +18 -0
- package/dist/role/derivation.js +1 -0
- package/dist/role/index.d.ts +5 -0
- package/dist/role/index.js +1 -0
- package/dist/role/model.d.ts +8 -0
- package/dist/role/model.js +1 -0
- package/dist/role/resolution.d.ts +11 -0
- package/dist/role/resolution.js +1 -0
- package/dist/role/types.d.ts +11 -0
- package/dist/role/types.js +1 -0
- package/dist/rules.d.ts +2 -0
- package/dist/rules.js +1 -9
- package/dist/safety/confirm-gate.js +1 -88
- package/dist/safety/index.js +1 -3
- package/dist/safety/preview.js +1 -52
- package/dist/schema/call/allocation.js +1 -34
- package/dist/schema/call/arbitration.js +1 -113
- package/dist/schema/call/base.d.ts +15 -15
- package/dist/schema/call/base.js +1 -370
- package/dist/schema/call/bridge-handler.js +1 -265
- package/dist/schema/call/bridge.d.ts +7 -7
- package/dist/schema/call/bridge.js +1 -458
- package/dist/schema/call/contact.js +1 -37
- package/dist/schema/call/demand.js +1 -47
- package/dist/schema/call/guard.js +1 -161
- package/dist/schema/call/handler.js +1 -322
- package/dist/schema/call/index.js +1 -20
- package/dist/schema/call/machine.js +1 -193
- package/dist/schema/call/order.js +1 -35
- package/dist/schema/call/payment.js +1 -37
- package/dist/schema/call/permission-handler.js +1 -54
- package/dist/schema/call/permission.js +1 -105
- package/dist/schema/call/personal.js +1 -78
- package/dist/schema/call/progress.js +1 -47
- package/dist/schema/call/proof.js +1 -33
- package/dist/schema/call/repository.js +1 -77
- package/dist/schema/call/reward.js +1 -30
- package/dist/schema/call/semantic.js +1 -1657
- package/dist/schema/call/service.js +1 -178
- package/dist/schema/call/treasury.js +1 -71
- package/dist/schema/common/index.js +1 -407
- package/dist/schema/config/index.js +1 -68
- package/dist/schema/evaluation/index.d.ts +4436 -0
- package/dist/schema/evaluation/index.js +1 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.js +1 -13
- package/dist/schema/intent-radar/index.d.ts +284 -0
- package/dist/schema/intent-radar/index.js +1 -0
- package/dist/schema/local/index.d.ts +21 -21
- package/dist/schema/local/index.js +1 -927
- package/dist/schema/local/wip.js +1 -187
- package/dist/schema/messenger/index.d.ts +7 -7
- package/dist/schema/messenger/index.js +1 -475
- package/dist/schema/operations.d.ts +7 -7
- package/dist/schema/operations.js +1 -520
- package/dist/schema/persona/index.d.ts +1985 -0
- package/dist/schema/persona/index.js +1 -0
- package/dist/schema/project/index.d.ts +96 -50
- package/dist/schema/project/index.js +1 -2057
- package/dist/schema/query/index.d.ts +423 -7
- package/dist/schema/query/index.js +1 -1640
- package/dist/schema/schema-query/index.js +1 -104
- package/dist/schema/schema-version.js +1 -76
- package/dist/schema/sync-layer4.d.ts +1 -1
- package/dist/schema/sync-layer4.js +1 -282
- package/dist/schema/task-status.d.ts +168 -0
- package/dist/schema/task-status.js +1 -0
- package/dist/schema/trust/index.js +1 -314
- package/dist/schema/utils/guard-parser.js +1 -419
- package/dist/schema/utils/guard-query-utils.js +1 -46
- package/dist/schema/utils/node-parser.js +1 -369
- package/dist/schema/utils/object-type-utils.js +1 -35
- package/dist/schema/utils/permission-index-utils.js +1 -7
- package/dist/schema/utils/permission-machine-check.js +1 -121
- package/dist/schema/utils/skills-recommendation.js +1 -77
- package/dist/schema-query/index.js +1 -810
- package/dist/schemas/account_operation.output.json +5 -2
- package/dist/schemas/bridge_operation.output.json +5 -2
- package/dist/schemas/evaluation_operation.output.json +782 -0
- package/dist/schemas/evaluation_operation.schema.json +990 -0
- package/dist/schemas/index.json +25 -1
- package/dist/schemas/intent_radar.output.json +232 -0
- package/dist/schemas/intent_radar.schema.json +138 -0
- package/dist/schemas/local_info_operation.output.json +5 -2
- package/dist/schemas/local_mark_operation.output.json +5 -2
- package/dist/schemas/messenger_operation.output.json +5 -2
- package/dist/schemas/onchain_events.output.json +5 -2
- package/dist/schemas/onchain_operations.output.json +5 -2
- package/dist/schemas/onchain_operations.schema.json +6 -6
- package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +2 -2
- package/dist/schemas/onchain_operations_service.schema.json +3 -3
- package/dist/schemas/onchain_table_data.output.json +6 -3
- package/dist/schemas/persona_operation.output.json +392 -0
- package/dist/schemas/persona_operation.schema.json +250 -0
- package/dist/schemas/project_operation.output.json +28 -8
- package/dist/schemas/query_task_status.output.json +115 -0
- package/dist/schemas/query_task_status.schema.json +24 -0
- package/dist/schemas/query_toolkit.output.json +9 -6
- package/dist/schemas/trust_score.schema.json +1 -1
- package/dist/schemas/wowok_buildin_info.output.json +132 -0
- package/dist/schemas/wowok_buildin_info.schema.json +14 -0
- package/dist/telemetry/index.js +1 -112
- package/dist/telemetry/redact.js +1 -23
- package/dist/telemetry/storage.js +1 -80
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -74
- package/dist/tools/handlers/evaluation.d.ts +2 -0
- package/dist/tools/handlers/evaluation.js +1 -0
- package/dist/tools/handlers/file-export.js +1 -90
- package/dist/tools/handlers/intent-radar.d.ts +2 -0
- package/dist/tools/handlers/intent-radar.js +1 -0
- package/dist/tools/handlers/local.js +1 -53
- package/dist/tools/handlers/messenger.js +1 -188
- package/dist/tools/handlers/onchain.js +1 -1082
- package/dist/tools/handlers/persona.d.ts +4 -0
- package/dist/tools/handlers/persona.js +1 -0
- package/dist/tools/handlers/project.js +1 -211
- package/dist/tools/handlers/query.js +1 -434
- package/dist/tools/handlers/schema-query.js +1 -176
- package/dist/tools/handlers/task-status.d.ts +0 -168
- package/dist/tools/handlers/task-status.js +1 -55
- package/dist/tools/handlers/trust.js +1 -380
- package/dist/tools/handlers/wip.js +1 -90
- package/dist/tools/index.js +1 -1306
- package/dist/tools/retry.js +1 -85
- package/dist/tools/rules-hook.js +1 -23
- package/dist/tools/shared.js +1 -130
- package/dist/tools/types.js +1 -1
- package/dist/tools/upgrade-check.d.ts +19 -0
- package/dist/tools/upgrade-check.js +1 -0
- package/dist/tools/wip-deploy-assist.d.ts +1 -1
- package/dist/tools/wip-deploy-assist.js +1 -278
- package/dist/tools/wrap.js +1 -500
- package/package.json +5 -3
|
@@ -1,404 +1 @@
|
|
|
1
|
-
export const DEFAULT_VALUE_WARNINGS = {
|
|
2
|
-
defaultAccount: 'Using default account (env.account="")',
|
|
3
|
-
mainnet: "Operating on mainnet — irreversible",
|
|
4
|
-
replaceExistName: "replaceExistName=true will unbind the existing name (breaking refs)",
|
|
5
|
-
defaultToken: "Using default token 0x2::wow::WOW",
|
|
6
|
-
};
|
|
7
|
-
export const DEFAULT_AMOUNT_THRESHOLD = BigInt(100_000_000_000);
|
|
8
|
-
export function getAmountThreshold() {
|
|
9
|
-
const raw = process.env.WOWOK_AMOUNT_THRESHOLD;
|
|
10
|
-
if (!raw)
|
|
11
|
-
return DEFAULT_AMOUNT_THRESHOLD;
|
|
12
|
-
try {
|
|
13
|
-
return BigInt(raw);
|
|
14
|
-
}
|
|
15
|
-
catch {
|
|
16
|
-
return DEFAULT_AMOUNT_THRESHOLD;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const WOW_PRECISION = 1000000000n;
|
|
20
|
-
export function formatAmount(value, precision = WOW_PRECISION) {
|
|
21
|
-
const v = typeof value === "string" ? BigInt(value) : value;
|
|
22
|
-
const whole = v / precision;
|
|
23
|
-
const frac = v % precision;
|
|
24
|
-
if (frac === 0n)
|
|
25
|
-
return `${whole.toString()}`;
|
|
26
|
-
const fracStr = frac.toString().padStart(Number(precision.toString().length) - 1, "0");
|
|
27
|
-
return `${whole.toString()}.${fracStr}`;
|
|
28
|
-
}
|
|
29
|
-
export function collectDefaultWarnings(env, data) {
|
|
30
|
-
const w = [];
|
|
31
|
-
const acc = env?.account;
|
|
32
|
-
if (acc === undefined || acc === "") {
|
|
33
|
-
w.push(DEFAULT_VALUE_WARNINGS.defaultAccount);
|
|
34
|
-
}
|
|
35
|
-
const net = env?.network;
|
|
36
|
-
if (net && /mainnet/i.test(String(net))) {
|
|
37
|
-
w.push(DEFAULT_VALUE_WARNINGS.mainnet);
|
|
38
|
-
}
|
|
39
|
-
const nn = data?.namedNew ?? data?.object;
|
|
40
|
-
if (nn && typeof nn === "object" && nn.replaceExistName === true) {
|
|
41
|
-
w.push(DEFAULT_VALUE_WARNINGS.replaceExistName);
|
|
42
|
-
}
|
|
43
|
-
return w;
|
|
44
|
-
}
|
|
45
|
-
export const CONFIRMATION_RULES = [
|
|
46
|
-
{
|
|
47
|
-
id: "irreversible_fund_or_verdict",
|
|
48
|
-
when: (ot, data, _env) => {
|
|
49
|
-
if (ot === "payment")
|
|
50
|
-
return true;
|
|
51
|
-
if (ot === "arbitration" && data?.arbitration !== undefined)
|
|
52
|
-
return true;
|
|
53
|
-
if (ot === "treasury") {
|
|
54
|
-
if (data?.withdraw || data?.owner_receive)
|
|
55
|
-
return true;
|
|
56
|
-
if (data?.external_withdraw || data?.external_deposit)
|
|
57
|
-
return true;
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
return false;
|
|
61
|
-
},
|
|
62
|
-
level: "irreversible",
|
|
63
|
-
preview: (ot, data, env) => ({
|
|
64
|
-
level: "irreversible",
|
|
65
|
-
operation: ot,
|
|
66
|
-
irreversible: true,
|
|
67
|
-
network: env?.network,
|
|
68
|
-
account: env?.account ?? "",
|
|
69
|
-
warnings: collectDefaultWarnings(env, data),
|
|
70
|
-
amount: ot === "payment" && data?.amount
|
|
71
|
-
? {
|
|
72
|
-
value: String(data.amount.amount ?? data.amount.balance ?? ""),
|
|
73
|
-
token: data?.token_type ?? "0x2::wow::WOW",
|
|
74
|
-
human_readable: formatAmount(String(data.amount.amount ?? data.amount.balance ?? "0")),
|
|
75
|
-
recipient: data?.to ?? data?.recipient,
|
|
76
|
-
}
|
|
77
|
-
: undefined,
|
|
78
|
-
}),
|
|
79
|
-
bypass_on_explicit_intent: [],
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
id: "publish_immutable",
|
|
83
|
-
when: (ot, data, _env) => {
|
|
84
|
-
if (ot === "service" && (data?.publish === true || data?.bPublished === true))
|
|
85
|
-
return true;
|
|
86
|
-
if (ot === "machine" && data?.publish === true)
|
|
87
|
-
return true;
|
|
88
|
-
return false;
|
|
89
|
-
},
|
|
90
|
-
level: "publish",
|
|
91
|
-
preview: (ot, data, env) => ({
|
|
92
|
-
level: "publish",
|
|
93
|
-
operation: ot,
|
|
94
|
-
object: data?.object ?? data?.namedNew?.name,
|
|
95
|
-
network: env?.network,
|
|
96
|
-
account: env?.account ?? "",
|
|
97
|
-
immutable_after: ot === "service"
|
|
98
|
-
? ["machine", "order_allocators"]
|
|
99
|
-
: ["nodes", "pairs", "forwards"],
|
|
100
|
-
warnings: collectDefaultWarnings(env, data),
|
|
101
|
-
}),
|
|
102
|
-
bypass_on_explicit_intent: ["force publish", "publish now"],
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
id: "amount_sensitive",
|
|
106
|
-
when: (ot, data, _env) => {
|
|
107
|
-
const amt = extractAmount(data);
|
|
108
|
-
if (amt === null)
|
|
109
|
-
return false;
|
|
110
|
-
if (ot === "reward" || ot === "treasury")
|
|
111
|
-
return true;
|
|
112
|
-
if (ot === "service" && data?.compensation_fund_add)
|
|
113
|
-
return true;
|
|
114
|
-
return false;
|
|
115
|
-
},
|
|
116
|
-
level: "amount",
|
|
117
|
-
preview: (ot, data, env) => {
|
|
118
|
-
const amt = extractAmount(data);
|
|
119
|
-
return {
|
|
120
|
-
level: "amount",
|
|
121
|
-
operation: ot,
|
|
122
|
-
object: data?.object ?? data?.namedNew?.name,
|
|
123
|
-
network: env?.network,
|
|
124
|
-
account: env?.account ?? "",
|
|
125
|
-
amount: amt
|
|
126
|
-
? {
|
|
127
|
-
value: amt,
|
|
128
|
-
token: data?.token_type ?? "0x2::wow::WOW",
|
|
129
|
-
human_readable: formatAmount(amt),
|
|
130
|
-
}
|
|
131
|
-
: undefined,
|
|
132
|
-
warnings: collectDefaultWarnings(env, data),
|
|
133
|
-
};
|
|
134
|
-
},
|
|
135
|
-
bypass_on_explicit_intent: [],
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
id: "default_values",
|
|
139
|
-
when: (_ot, _data, env) => {
|
|
140
|
-
return collectDefaultWarnings(env, _data).length > 0;
|
|
141
|
-
},
|
|
142
|
-
level: "standard",
|
|
143
|
-
preview: (ot, data, env) => ({
|
|
144
|
-
level: "standard",
|
|
145
|
-
operation: ot,
|
|
146
|
-
object: data?.object ?? data?.namedNew?.name,
|
|
147
|
-
network: env?.network,
|
|
148
|
-
account: env?.account ?? "",
|
|
149
|
-
warnings: collectDefaultWarnings(env, data),
|
|
150
|
-
}),
|
|
151
|
-
bypass_on_explicit_intent: [
|
|
152
|
-
"use default account",
|
|
153
|
-
"default account is fine",
|
|
154
|
-
"use the default account",
|
|
155
|
-
"default account works fine",
|
|
156
|
-
],
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
id: "guard_create_immutable",
|
|
160
|
-
when: (ot, data, _env) => {
|
|
161
|
-
if (ot === "guard")
|
|
162
|
-
return true;
|
|
163
|
-
return false;
|
|
164
|
-
},
|
|
165
|
-
level: "irreversible",
|
|
166
|
-
preview: (ot, data, env) => {
|
|
167
|
-
const table = data?.table ?? [];
|
|
168
|
-
const root = data?.root;
|
|
169
|
-
const rely = data?.rely;
|
|
170
|
-
const rootType = typeof root === 'object' && root !== null && 'type' in root
|
|
171
|
-
? root.type
|
|
172
|
-
: typeof root === 'object' && root !== null && 'type' in root && root.type === 'file'
|
|
173
|
-
? 'file'
|
|
174
|
-
: 'unknown';
|
|
175
|
-
const immutable_fields = ['table', 'root'];
|
|
176
|
-
if (rely)
|
|
177
|
-
immutable_fields.push('rely');
|
|
178
|
-
return {
|
|
179
|
-
level: "irreversible",
|
|
180
|
-
operation: ot,
|
|
181
|
-
object: data?.namedNew?.name,
|
|
182
|
-
network: env?.network,
|
|
183
|
-
account: env?.account ?? "",
|
|
184
|
-
immutable_after: immutable_fields,
|
|
185
|
-
irreversible: true,
|
|
186
|
-
warnings: [
|
|
187
|
-
...collectDefaultWarnings(env, data),
|
|
188
|
-
`Guard is CREATE-only and immutable — cannot be edited or deleted after creation`,
|
|
189
|
-
`Table entries: ${table.length} (max 256)`,
|
|
190
|
-
`Root node type: ${rootType} (must return Bool)`,
|
|
191
|
-
...(rely ? [`Rely dependencies: ${rely.guards?.length ?? 0} (max 4, AND/OR logic)`] : []),
|
|
192
|
-
`To modify later: export via guard2file → edit → CREATE new → rebind`,
|
|
193
|
-
],
|
|
194
|
-
};
|
|
195
|
-
},
|
|
196
|
-
bypass_on_explicit_intent: [],
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
id: "guard_gen_passport_test",
|
|
200
|
-
when: (ot, _data, _env) => {
|
|
201
|
-
if (ot === "gen_passport")
|
|
202
|
-
return true;
|
|
203
|
-
return false;
|
|
204
|
-
},
|
|
205
|
-
level: "standard",
|
|
206
|
-
preview: (ot, data, env) => ({
|
|
207
|
-
level: "standard",
|
|
208
|
-
operation: ot,
|
|
209
|
-
object: data?.guard,
|
|
210
|
-
network: env?.network,
|
|
211
|
-
account: env?.account ?? "",
|
|
212
|
-
warnings: [
|
|
213
|
-
...collectDefaultWarnings(env, data),
|
|
214
|
-
"gen_passport will consume gas for static testing",
|
|
215
|
-
],
|
|
216
|
-
}),
|
|
217
|
-
bypass_on_explicit_intent: ["test guard", "testing guard", "gen passport", "generate passport"],
|
|
218
|
-
},
|
|
219
|
-
];
|
|
220
|
-
export function extractAmount(data) {
|
|
221
|
-
if (!data)
|
|
222
|
-
return null;
|
|
223
|
-
const candidates = [
|
|
224
|
-
data?.amount?.amount,
|
|
225
|
-
data?.amount?.balance,
|
|
226
|
-
data?.balance,
|
|
227
|
-
data?.amount,
|
|
228
|
-
data?.compensation_fund_add,
|
|
229
|
-
data?.deposit?.coin?.balance,
|
|
230
|
-
typeof data?.deposit?.coin?.coin === "string"
|
|
231
|
-
? undefined
|
|
232
|
-
: data?.deposit?.coin?.coin?.balance,
|
|
233
|
-
];
|
|
234
|
-
for (const c of candidates) {
|
|
235
|
-
if (c !== undefined && c !== null && c !== "")
|
|
236
|
-
return String(c);
|
|
237
|
-
}
|
|
238
|
-
return null;
|
|
239
|
-
}
|
|
240
|
-
export const OBJECT_REUSE_RULES = [
|
|
241
|
-
{
|
|
242
|
-
rule_id: "REUSE-001",
|
|
243
|
-
object_type: "permission",
|
|
244
|
-
recommendation: "strongly_recommended",
|
|
245
|
-
reason: "Centralized permission control across all services",
|
|
246
|
-
ask_user: "Do you have an existing Permission to reuse? Provide the name or ID.",
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
rule_id: "REUSE-002",
|
|
250
|
-
object_type: "machine",
|
|
251
|
-
recommendation: "recommended",
|
|
252
|
-
reason: "Save design time for similar processes",
|
|
253
|
-
ask_user: "Do you have an existing Machine whose workflow fits? Provide the name or ID.",
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
rule_id: "REUSE-003",
|
|
257
|
-
object_type: "guard",
|
|
258
|
-
recommendation: "recommended",
|
|
259
|
-
reason: "Avoid redundant validation rules",
|
|
260
|
-
ask_user: "Do you have an existing Guard with matching validation logic? Provide the name or ID.",
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
rule_id: "REUSE-004",
|
|
264
|
-
object_type: "contact",
|
|
265
|
-
recommendation: "recommended",
|
|
266
|
-
reason: "Single point of customer-service management",
|
|
267
|
-
ask_user: "Do you have an existing Contact for customer service? Provide the name or ID.",
|
|
268
|
-
},
|
|
269
|
-
{
|
|
270
|
-
rule_id: "REUSE-005",
|
|
271
|
-
object_type: "arbitration",
|
|
272
|
-
recommendation: "always_reuse",
|
|
273
|
-
reason: "Customers choose from established arbiters; creating a new Arbitration is an operator-level decision",
|
|
274
|
-
ask_user: "Which existing Arbitration service should disputes route to? Provide the name or ID.",
|
|
275
|
-
},
|
|
276
|
-
];
|
|
277
|
-
export const CREATE_VS_MODIFY_PATTERN = {
|
|
278
|
-
reuse_form: "string",
|
|
279
|
-
create_form: "object",
|
|
280
|
-
resolution_api: "GetObjectExisted",
|
|
281
|
-
note: "String reference = REUSE (name resolution failure is a hard error); object shape = CREATE (always).",
|
|
282
|
-
};
|
|
283
|
-
export const IMMUTABILITY_RULES = [
|
|
284
|
-
{
|
|
285
|
-
rule_id: "IMMUT-001",
|
|
286
|
-
object_type: "machine",
|
|
287
|
-
trigger: "publish",
|
|
288
|
-
immutable_fields: ["nodes", "pairs", "forwards"],
|
|
289
|
-
message: "Machine topology is immutable after publish — verify all nodes/forwards via machineNode2file BEFORE publishing",
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
rule_id: "IMMUT-002",
|
|
293
|
-
object_type: "service",
|
|
294
|
-
trigger: "publish",
|
|
295
|
-
immutable_fields: ["machine", "order_allocators", "arbitrations"],
|
|
296
|
-
mutable_after: ["sales"],
|
|
297
|
-
message: "Service.machine, order_allocators and arbitrations are frozen after publish; sales remains fully modifiable (L3) without pause",
|
|
298
|
-
},
|
|
299
|
-
{
|
|
300
|
-
rule_id: "IMMUT-003",
|
|
301
|
-
object_type: "guard",
|
|
302
|
-
trigger: "create",
|
|
303
|
-
immutable_fields: ["table", "root", "rely"],
|
|
304
|
-
message: "Guard is CREATE-only and immutable — cannot be edited or deleted after creation. To change: export via guard2file → edit → CREATE new → rebind",
|
|
305
|
-
},
|
|
306
|
-
];
|
|
307
|
-
export const OPERATION_TYPE_CLASSIFICATION = {
|
|
308
|
-
LOCAL_ONLY: [
|
|
309
|
-
"account_operation",
|
|
310
|
-
"local_mark_operation",
|
|
311
|
-
"local_info_operation",
|
|
312
|
-
"project_operation",
|
|
313
|
-
"config_operation",
|
|
314
|
-
],
|
|
315
|
-
ONCHAIN: [
|
|
316
|
-
"onchain_operations",
|
|
317
|
-
"wip_file",
|
|
318
|
-
"bridge_operation",
|
|
319
|
-
"messenger_operation",
|
|
320
|
-
],
|
|
321
|
-
QUERY: [
|
|
322
|
-
"query_toolkit",
|
|
323
|
-
"onchain_table_data",
|
|
324
|
-
"onchain_events",
|
|
325
|
-
"guard2file",
|
|
326
|
-
"machineNode2file",
|
|
327
|
-
"schema_query",
|
|
328
|
-
"wowok_buildin_info",
|
|
329
|
-
"trust_score",
|
|
330
|
-
],
|
|
331
|
-
ENCRYPTED: [
|
|
332
|
-
"messenger_operation",
|
|
333
|
-
],
|
|
334
|
-
};
|
|
335
|
-
export const OPERATION_CLASS_META = {
|
|
336
|
-
LOCAL_ONLY: { gas: false, confirmation_required: false, note: "Local state only — no gas, no confirmation needed" },
|
|
337
|
-
ONCHAIN: { gas: true, confirmation_required: true, note: "On-chain write — gas consumed, explicit user confirmation REQUIRED before execution" },
|
|
338
|
-
QUERY: { gas: false, confirmation_required: false, note: "Read-only — no gas, no confirmation needed" },
|
|
339
|
-
ENCRYPTED: { gas: false, confirmation_required: false, note: "Local encryption — no gas, no confirmation needed" },
|
|
340
|
-
};
|
|
341
|
-
export function classifyTool(toolName) {
|
|
342
|
-
if (OPERATION_TYPE_CLASSIFICATION.ENCRYPTED.includes(toolName))
|
|
343
|
-
return "ENCRYPTED";
|
|
344
|
-
for (const cls of ["LOCAL_ONLY", "ONCHAIN", "QUERY"]) {
|
|
345
|
-
if (OPERATION_TYPE_CLASSIFICATION[cls].includes(toolName))
|
|
346
|
-
return cls;
|
|
347
|
-
}
|
|
348
|
-
return undefined;
|
|
349
|
-
}
|
|
350
|
-
export const NAMING_CONVENTIONS = {
|
|
351
|
-
scheme: "<projectPrefix>_<type>_<purpose>_<version>",
|
|
352
|
-
parts: {
|
|
353
|
-
project_prefix: { example: "shopFunny_", purpose: "Prevents cross-project collisions" },
|
|
354
|
-
type_prefix: { example: "machine_ / guard_ / service_", purpose: "Clarifies object type" },
|
|
355
|
-
purpose_suffix: { example: "serviceWithdraw", purpose: "Describes function" },
|
|
356
|
-
version_suffix: { example: "_v2", purpose: "Enables iteration without replaceExistName" },
|
|
357
|
-
},
|
|
358
|
-
entry_id: { pattern: "^<object_type>:<name>$", example: "service:myshop_service" },
|
|
359
|
-
replace_exist_name: {
|
|
360
|
-
default: false,
|
|
361
|
-
false_effect: "Throws error if name is in use — safe default",
|
|
362
|
-
true_effect: "Existing object/account with the same name is suspended/unbound to free the name",
|
|
363
|
-
account_default_forbidden: "replaceExistName:true on the default account (name='') is FORBIDDEN — use suspend() explicitly",
|
|
364
|
-
recommendation: "DISCOURAGED — prefer versioned names (_v1, _v2) for production",
|
|
365
|
-
},
|
|
366
|
-
recommendations: [
|
|
367
|
-
"Always provide tags on object creation for filtering and management",
|
|
368
|
-
"Use names as primary identifiers; use short address form (0x1234...def) only for display",
|
|
369
|
-
"All cross-object references (Guard tables, Service bindings, Machine forwards) use NAMES — resolved per-network at build time",
|
|
370
|
-
],
|
|
371
|
-
};
|
|
372
|
-
export function checkObjectReuseRules(planned) {
|
|
373
|
-
const risks = [];
|
|
374
|
-
for (const p of planned) {
|
|
375
|
-
if (!p.is_new)
|
|
376
|
-
continue;
|
|
377
|
-
const rule = OBJECT_REUSE_RULES.find((r) => r.object_type === p.object_type);
|
|
378
|
-
if (!rule)
|
|
379
|
-
continue;
|
|
380
|
-
if (rule.recommendation === "always_reuse" || rule.recommendation === "strongly_recommended") {
|
|
381
|
-
risks.push({
|
|
382
|
-
rule_id: rule.rule_id,
|
|
383
|
-
severity: rule.recommendation === "always_reuse" ? "warn" : "info",
|
|
384
|
-
message: `Creating NEW ${p.object_type}${p.name ? ` "${p.name}"` : ""} — reuse is ${rule.recommendation}: ${rule.reason}. ${rule.ask_user}`,
|
|
385
|
-
});
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return risks;
|
|
389
|
-
}
|
|
390
|
-
export function checkImmutabilityRules(ops) {
|
|
391
|
-
const risks = [];
|
|
392
|
-
for (const op of ops) {
|
|
393
|
-
const rule = IMMUTABILITY_RULES.find((r) => r.object_type === op.object_type && r.trigger === op.trigger);
|
|
394
|
-
if (!rule)
|
|
395
|
-
continue;
|
|
396
|
-
risks.push({
|
|
397
|
-
rule_id: rule.rule_id,
|
|
398
|
-
severity: "warn",
|
|
399
|
-
message: `${op.object_type}${op.name ? ` "${op.name}"` : ""} ${op.trigger}: ${rule.message}. Immutable: [${rule.immutable_fields.join(", ")}]${rule.mutable_after ? `. Still mutable: [${rule.mutable_after.join(", ")}]` : ""}`,
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
return risks;
|
|
403
|
-
}
|
|
404
|
-
export const SAFETY_RULES_VERSION = 2;
|
|
1
|
+
export const DEFAULT_VALUE_WARNINGS={'defaultAccount':'Using\x20default\x20account\x20(env.account=\x22\x22)','mainnet':'Operating\x20on\x20mainnet\x20—\x20irreversible','replaceExistName':'replaceExistName=true\x20will\x20unbind\x20the\x20existing\x20name\x20(breaking\x20refs)','defaultToken':'Using\x20default\x20token\x200x2::wow::WOW'};export const DEFAULT_AMOUNT_THRESHOLD=BigInt(0x174876e800);export function getAmountThreshold(){const a=process['env']['WOWOK_AMOUNT_THRESHOLD'];if(!a)return DEFAULT_AMOUNT_THRESHOLD;try{return BigInt(a);}catch{return DEFAULT_AMOUNT_THRESHOLD;}}const WOW_PRECISION=0x3b9aca00n;export function formatAmount(a,b=WOW_PRECISION){const c=typeof a==='string'?BigInt(a):a,d=c/b,e=c%b;if(e===0x0n)return''+d['toString']();const f=e['toString']()['padStart'](Number(b['toString']()['length'])-0x1,'0');return d['toString']()+'.'+f;}export function collectDefaultWarnings(a,b){const c=[],d=a?.['account'];(d===undefined||d==='')&&c['push'](DEFAULT_VALUE_WARNINGS['defaultAccount']);const e=a?.['network'];e&&/mainnet/i['test'](String(e))&&c['push'](DEFAULT_VALUE_WARNINGS['mainnet']);const f=b?.['namedNew']??b?.['object'];return f&&typeof f==='object'&&f['replaceExistName']===!![]&&c['push'](DEFAULT_VALUE_WARNINGS['replaceExistName']),c;}export const CONFIRMATION_RULES=[{'id':'irreversible_fund_or_verdict','when':(a,b,c)=>{if(a==='payment')return!![];if(a==='arbitration'&&b?.['arbitration']!==undefined)return!![];if(a==='treasury'){if(b?.['withdraw']||b?.['owner_receive'])return!![];if(b?.['external_withdraw']||b?.['external_deposit'])return!![];return![];}return![];},'level':'irreversible','preview':(a,b,c)=>({'level':'irreversible','operation':a,'irreversible':!![],'network':c?.['network'],'account':c?.['account']??'','warnings':collectDefaultWarnings(c,b),'amount':a==='payment'&&b?.['amount']?{'value':String(b['amount']['amount']??b['amount']['balance']??''),'token':b?.['token_type']??'0x2::wow::WOW','human_readable':formatAmount(String(b['amount']['amount']??b['amount']['balance']??'0')),'recipient':b?.['to']??b?.['recipient']}:undefined}),'bypass_on_explicit_intent':[]},{'id':'publish_immutable','when':(a,b,c)=>{if(a==='service'&&(b?.['publish']===!![]||b?.['bPublished']===!![]))return!![];if(a==='machine'&&b?.['publish']===!![])return!![];return![];},'level':'publish','preview':(a,b,c)=>({'level':'publish','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','immutable_after':a==='service'?['machine','order_allocators']:['nodes','pairs','forwards'],'warnings':collectDefaultWarnings(c,b)}),'bypass_on_explicit_intent':['force\x20publish','publish\x20now']},{'id':'amount_sensitive','when':(a,b,c)=>{const d=extractAmount(b);if(d===null)return![];if(a==='reward'||a==='treasury')return!![];if(a==='service'&&b?.['compensation_fund_add'])return!![];return![];},'level':'amount','preview':(a,b,c)=>{const d=extractAmount(b);return{'level':'amount','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','amount':d?{'value':d,'token':b?.['token_type']??'0x2::wow::WOW','human_readable':formatAmount(d)}:undefined,'warnings':collectDefaultWarnings(c,b)};},'bypass_on_explicit_intent':[]},{'id':'default_values','when':(a,b,c)=>{return collectDefaultWarnings(c,b)['length']>0x0;},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['object']??b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','warnings':collectDefaultWarnings(c,b)}),'bypass_on_explicit_intent':['use\x20default\x20account','default\x20account\x20is\x20fine','use\x20the\x20default\x20account','default\x20account\x20works\x20fine']},{'id':'guard_create_immutable','when':(a,b,c)=>{if(a==='guard')return!![];return![];},'level':'irreversible','preview':(a,b,c)=>{const d=b?.['table']??[],e=b?.['root'],f=b?.['rely'],g=typeof e==='object'&&e!==null&&'type'in e?e['type']:typeof e==='object'&&e!==null&&'type'in e&&e['type']==='file'?'file':'unknown',h=['table','root'];if(f)h['push']('rely');return{'level':'irreversible','operation':a,'object':b?.['namedNew']?.['name'],'network':c?.['network'],'account':c?.['account']??'','immutable_after':h,'irreversible':!![],'warnings':[...collectDefaultWarnings(c,b),'Guard\x20is\x20CREATE-only\x20and\x20immutable\x20—\x20cannot\x20be\x20edited\x20or\x20deleted\x20after\x20creation','Table\x20entries:\x20'+d['length']+'\x20(max\x20256)','Root\x20node\x20type:\x20'+g+'\x20(must\x20return\x20Bool)',...f?['Rely\x20dependencies:\x20'+(f['guards']?.['length']??0x0)+'\x20(max\x204,\x20AND/OR\x20logic)']:[],'To\x20modify\x20later:\x20export\x20via\x20guard2file\x20→\x20edit\x20→\x20CREATE\x20new\x20→\x20rebind']};},'bypass_on_explicit_intent':[]},{'id':'guard_gen_passport_test','when':(a,b,c)=>{if(a==='gen_passport')return!![];return![];},'level':'standard','preview':(a,b,c)=>({'level':'standard','operation':a,'object':b?.['guard'],'network':c?.['network'],'account':c?.['account']??'','warnings':[...collectDefaultWarnings(c,b),'gen_passport\x20will\x20consume\x20gas\x20for\x20static\x20testing']}),'bypass_on_explicit_intent':['test\x20guard','testing\x20guard','gen\x20passport','generate\x20passport']}];export function extractAmount(a){if(!a)return null;const b=[a?.['amount']?.['amount'],a?.['amount']?.['balance'],a?.['balance'],a?.['amount'],a?.['compensation_fund_add'],a?.['deposit']?.['coin']?.['balance'],typeof a?.['deposit']?.['coin']?.['coin']==='string'?undefined:a?.['deposit']?.['coin']?.['coin']?.['balance']];for(const d of b){if(d!==undefined&&d!==null&&d!=='')return String(d);}return null;}export const OBJECT_REUSE_RULES=[{'rule_id':'REUSE-001','object_type':'permission','recommendation':'strongly_recommended','reason':'Centralized\x20permission\x20control\x20across\x20all\x20services','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Permission\x20to\x20reuse?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-002','object_type':'machine','recommendation':'recommended','reason':'Save\x20design\x20time\x20for\x20similar\x20processes','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Machine\x20whose\x20workflow\x20fits?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-003','object_type':'guard','recommendation':'recommended','reason':'Avoid\x20redundant\x20validation\x20rules','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Guard\x20with\x20matching\x20validation\x20logic?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-004','object_type':'contact','recommendation':'recommended','reason':'Single\x20point\x20of\x20customer-service\x20management','ask_user':'Do\x20you\x20have\x20an\x20existing\x20Contact\x20for\x20customer\x20service?\x20Provide\x20the\x20name\x20or\x20ID.'},{'rule_id':'REUSE-005','object_type':'arbitration','recommendation':'always_reuse','reason':'Customers\x20choose\x20from\x20established\x20arbiters;\x20creating\x20a\x20new\x20Arbitration\x20is\x20an\x20operator-level\x20decision','ask_user':'Which\x20existing\x20Arbitration\x20service\x20should\x20disputes\x20route\x20to?\x20Provide\x20the\x20name\x20or\x20ID.'}];export const CREATE_VS_MODIFY_PATTERN={'reuse_form':'string','create_form':'object','resolution_api':'GetObjectExisted','note':'String\x20reference\x20=\x20REUSE\x20(name\x20resolution\x20failure\x20is\x20a\x20hard\x20error);\x20object\x20shape\x20=\x20CREATE\x20(always).'};export const IMMUTABILITY_RULES=[{'rule_id':'IMMUT-001','object_type':'machine','trigger':'publish','immutable_fields':['nodes','pairs','forwards'],'message':'Machine\x20topology\x20is\x20immutable\x20after\x20publish\x20—\x20verify\x20all\x20nodes/forwards\x20via\x20machineNode2file\x20BEFORE\x20publishing'},{'rule_id':'IMMUT-002','object_type':'service','trigger':'publish','immutable_fields':['machine','order_allocators','arbitrations'],'mutable_after':['sales'],'message':'Service.machine,\x20order_allocators\x20and\x20arbitrations\x20are\x20frozen\x20after\x20publish;\x20sales\x20remains\x20fully\x20modifiable\x20(L3)\x20without\x20pause'},{'rule_id':'IMMUT-003','object_type':'guard','trigger':'create','immutable_fields':['table','root','rely'],'message':'Guard\x20is\x20CREATE-only\x20and\x20immutable\x20—\x20cannot\x20be\x20edited\x20or\x20deleted\x20after\x20creation.\x20To\x20change:\x20export\x20via\x20guard2file\x20→\x20edit\x20→\x20CREATE\x20new\x20→\x20rebind'}];export const OPERATION_TYPE_CLASSIFICATION={'LOCAL_ONLY':['account_operation','local_mark_operation','local_info_operation','project_operation','config_operation'],'ONCHAIN':['onchain_operations','wip_file','bridge_operation','messenger_operation'],'QUERY':['query_toolkit','onchain_table_data','onchain_events','guard2file','machineNode2file','schema_query','wowok_buildin_info','trust_score'],'ENCRYPTED':['messenger_operation']};export const OPERATION_CLASS_META={'LOCAL_ONLY':{'gas':![],'confirmation_required':![],'note':'Local\x20state\x20only\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'},'ONCHAIN':{'gas':!![],'confirmation_required':!![],'note':'On-chain\x20write\x20—\x20gas\x20consumed,\x20explicit\x20user\x20confirmation\x20REQUIRED\x20before\x20execution'},'QUERY':{'gas':![],'confirmation_required':![],'note':'Read-only\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'},'ENCRYPTED':{'gas':![],'confirmation_required':![],'note':'Local\x20encryption\x20—\x20no\x20gas,\x20no\x20confirmation\x20needed'}};export function classifyTool(a){if(OPERATION_TYPE_CLASSIFICATION['ENCRYPTED']['includes'](a))return'ENCRYPTED';for(const b of['LOCAL_ONLY','ONCHAIN','QUERY']){if(OPERATION_TYPE_CLASSIFICATION[b]['includes'](a))return b;}return undefined;}export const NAMING_CONVENTIONS={'scheme':'<projectPrefix>_<type>_<purpose>_<version>','parts':{'project_prefix':{'example':'shopFunny_','purpose':'Prevents\x20cross-project\x20collisions'},'type_prefix':{'example':'machine_\x20/\x20guard_\x20/\x20service_','purpose':'Clarifies\x20object\x20type'},'purpose_suffix':{'example':'serviceWithdraw','purpose':'Describes\x20function'},'version_suffix':{'example':'_v2','purpose':'Enables\x20iteration\x20without\x20replaceExistName'}},'entry_id':{'pattern':'^<object_type>:<name>$','example':'service:myshop_service'},'replace_exist_name':{'default':![],'false_effect':'Throws\x20error\x20if\x20name\x20is\x20in\x20use\x20—\x20safe\x20default','true_effect':'Existing\x20object/account\x20with\x20the\x20same\x20name\x20is\x20suspended/unbound\x20to\x20free\x20the\x20name','account_default_forbidden':'replaceExistName:true\x20on\x20the\x20default\x20account\x20(name=\x27\x27)\x20is\x20FORBIDDEN\x20—\x20use\x20suspend()\x20explicitly','recommendation':'DISCOURAGED\x20—\x20prefer\x20versioned\x20names\x20(_v1,\x20_v2)\x20for\x20production'},'recommendations':['Always\x20provide\x20tags\x20on\x20object\x20creation\x20for\x20filtering\x20and\x20management','Use\x20names\x20as\x20primary\x20identifiers;\x20use\x20short\x20address\x20form\x20(0x1234...def)\x20only\x20for\x20display','All\x20cross-object\x20references\x20(Guard\x20tables,\x20Service\x20bindings,\x20Machine\x20forwards)\x20use\x20NAMES\x20—\x20resolved\x20per-network\x20at\x20build\x20time']};export function checkObjectReuseRules(a){const b=[];for(const c of a){if(!c['is_new'])continue;const d=OBJECT_REUSE_RULES['find'](e=>e['object_type']===c['object_type']);if(!d)continue;(d['recommendation']==='always_reuse'||d['recommendation']==='strongly_recommended')&&b['push']({'rule_id':d['rule_id'],'severity':d['recommendation']==='always_reuse'?'warn':'info','message':'Creating\x20NEW\x20'+c['object_type']+(c['name']?'\x20\x22'+c['name']+'\x22':'')+'\x20—\x20reuse\x20is\x20'+d['recommendation']+':\x20'+d['reason']+'.\x20'+d['ask_user']});}return b;}export function checkImmutabilityRules(a){const b=[];for(const c of a){const d=IMMUTABILITY_RULES['find'](e=>e['object_type']===c['object_type']&&e['trigger']===c['trigger']);if(!d)continue;b['push']({'rule_id':d['rule_id'],'severity':'warn','message':''+c['object_type']+(c['name']?'\x20\x22'+c['name']+'\x22':'')+'\x20'+c['trigger']+':\x20'+d['message']+'.\x20Immutable:\x20['+d['immutable_fields']['join'](',\x20')+']'+(d['mutable_after']?'.\x20Still\x20mutable:\x20['+d['mutable_after']['join'](',\x20')+']':'')});}return b;}export const SAFETY_RULES_VERSION=0x2;
|