@wowok/agent-mcp 2.7.1 → 2.7.3
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/account-events.d.ts +32 -0
- package/dist/customer/account-events.js +1 -0
- package/dist/customer/customer-advice.d.ts +1 -0
- 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.d.ts +1 -1
- 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.d.ts +2 -0
- package/dist/customer/reminder-system.js +1 -316
- package/dist/customer/risk-assessment.d.ts +1 -0
- package/dist/customer/risk-assessment.js +1 -397
- package/dist/customer/types.d.ts +2 -0
- package/dist/customer/types.js +1 -13
- package/dist/customer/user-preferences.js +1 -460
- package/dist/evaluation/arbitration-game.d.ts +9 -2
- package/dist/evaluation/arbitration-game.js +1 -48
- package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
- package/dist/evaluation/builtins/arbitration-score.js +1 -0
- package/dist/evaluation/builtins/demand-match.js +1 -153
- package/dist/evaluation/builtins/index.d.ts +1 -0
- package/dist/evaluation/builtins/index.js +1 -10
- package/dist/evaluation/builtins/service-risk.js +1 -55
- package/dist/evaluation/capability.js +1 -13
- package/dist/evaluation/category-match-rules.d.ts +30 -0
- package/dist/evaluation/category-match-rules.js +1 -0
- package/dist/evaluation/composer.js +1 -40
- package/dist/evaluation/engine.js +1 -175
- package/dist/evaluation/extract.js +1 -115
- package/dist/evaluation/game-strategy.d.ts +27 -0
- package/dist/evaluation/game-strategy.js +1 -0
- package/dist/evaluation/gap.js +1 -100
- package/dist/evaluation/index.d.ts +2 -0
- package/dist/evaluation/index.js +1 -11
- package/dist/evaluation/location-match.d.ts +42 -0
- package/dist/evaluation/location-match.js +1 -0
- package/dist/evaluation/node-game.d.ts +31 -3
- package/dist/evaluation/node-game.js +1 -57
- package/dist/evaluation/path-reasoning.d.ts +35 -0
- package/dist/evaluation/path-reasoning.js +1 -0
- package/dist/evaluation/region.d.ts +6 -0
- package/dist/evaluation/region.js +1 -36
- package/dist/evaluation/types.d.ts +18 -0
- package/dist/evaluation/types.js +1 -1
- package/dist/evaluation/user-injection.js +1 -27
- 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.d.ts +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.d.ts +6 -0
- package/dist/extensions/index.js +1 -6
- package/dist/extensions/industry-layers.d.ts +75 -0
- package/dist/extensions/industry-layers.js +1 -0
- package/dist/extensions/industry-pack.d.ts +105 -0
- package/dist/extensions/industry-pack.js +1 -0
- package/dist/extensions/metric-registry.js +1 -257
- package/dist/extensions/mode-evaluator.d.ts +1 -1
- package/dist/extensions/mode-evaluator.js +1 -170
- package/dist/extensions/modes.js +1 -499
- package/dist/extensions/registry.d.ts +1 -0
- package/dist/extensions/registry.js +1 -717
- package/dist/extensions/types.js +1 -1
- package/dist/graph/base.d.ts +8 -0
- package/dist/graph/base.js +1 -0
- package/dist/harness/auto-escalation.js +1 -68
- package/dist/harness/checkpoint.js +1 -129
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/index.js +1 -78
- package/dist/harness/plan.d.ts +2 -0
- package/dist/harness/plan.js +1 -315
- package/dist/harness/recover.d.ts +1 -1
- package/dist/harness/recover.js +1 -139
- package/dist/harness/types.d.ts +2 -3
- package/dist/harness/types.js +1 -1
- package/dist/harness/verify.js +1 -237
- package/dist/index.js +1 -273
- package/dist/intent/enrich.js +1 -67
- package/dist/intent/index.js +1 -60
- package/dist/intent/matcher.js +1 -81
- package/dist/intent/store.js +1 -55
- package/dist/intent/types.js +1 -10
- 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/anti-cheat.d.ts +37 -0
- package/dist/knowledge/anti-cheat.js +1 -0
- package/dist/knowledge/arb-confirm.d.ts +28 -0
- package/dist/knowledge/arb-confirm.js +1 -0
- package/dist/knowledge/arb-risk.js +1 -210
- package/dist/knowledge/arb-translation.d.ts +48 -0
- package/dist/knowledge/arb-translation.js +1 -0
- 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 -423
- package/dist/knowledge/arbitration-templates.js +1 -276
- package/dist/knowledge/arbitration-translation.js +1 -487
- package/dist/knowledge/audit-rules.js +1 -141
- package/dist/knowledge/bridge-confirm.d.ts +26 -0
- package/dist/knowledge/bridge-confirm.js +1 -0
- package/dist/knowledge/bridge-risk.js +1 -263
- package/dist/knowledge/bridge-translation.d.ts +37 -0
- package/dist/knowledge/bridge-translation.js +1 -0
- package/dist/knowledge/contact-confirm.d.ts +27 -0
- package/dist/knowledge/contact-confirm.js +1 -0
- package/dist/knowledge/contact-risk.js +1 -200
- package/dist/knowledge/contact-templates.js +1 -60
- package/dist/knowledge/contact-translation.d.ts +39 -0
- package/dist/knowledge/contact-translation.js +1 -0
- package/dist/knowledge/demand-confirm.js +1 -206
- package/dist/knowledge/demand-context.d.ts +17 -0
- package/dist/knowledge/demand-context.js +1 -0
- package/dist/knowledge/demand-ledger.d.ts +26 -0
- package/dist/knowledge/demand-ledger.js +1 -0
- package/dist/knowledge/demand-matching.js +1 -132
- package/dist/knowledge/demand-puzzle.d.ts +29 -0
- package/dist/knowledge/demand-puzzle.js +1 -0
- package/dist/knowledge/demand-risk.js +1 -240
- package/dist/knowledge/demand-templates.d.ts +12 -0
- package/dist/knowledge/demand-templates.js +1 -0
- 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/evidence-review.d.ts +12 -0
- package/dist/knowledge/evidence-review.js +1 -0
- package/dist/knowledge/examples-scanner-cli.js +1 -26
- package/dist/knowledge/examples-scanner.js +1 -843
- package/dist/knowledge/flywheel-loop.d.ts +0 -1
- 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.d.ts +1 -1
- 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.d.ts +71 -3
- 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 -669
- 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/market-metrics.d.ts +12 -0
- package/dist/knowledge/market-metrics.js +1 -0
- package/dist/knowledge/market-operations.d.ts +46 -0
- package/dist/knowledge/market-operations.js +1 -0
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
- package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
- package/dist/knowledge/mcp-schema-audit.js +1 -777
- 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-confirm.d.ts +26 -0
- package/dist/knowledge/payment-confirm.js +1 -0
- package/dist/knowledge/payment-risk.js +1 -249
- package/dist/knowledge/payment-translation.d.ts +37 -0
- package/dist/knowledge/payment-translation.js +1 -0
- package/dist/knowledge/permission-confirm.js +1 -426
- package/dist/knowledge/permission-context.js +1 -224
- package/dist/knowledge/permission-ledger.d.ts +11 -0
- 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-confirm.d.ts +29 -0
- package/dist/knowledge/personal-confirm.js +1 -0
- package/dist/knowledge/personal-risk.js +1 -212
- package/dist/knowledge/personal-translation.d.ts +37 -0
- package/dist/knowledge/personal-translation.js +1 -0
- package/dist/knowledge/process-model.d.ts +1 -11
- 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-context.d.ts +17 -0
- package/dist/knowledge/proof-context.js +1 -0
- package/dist/knowledge/proof-ledger.d.ts +34 -0
- package/dist/knowledge/proof-ledger.js +1 -0
- package/dist/knowledge/proof-puzzle.d.ts +35 -0
- package/dist/knowledge/proof-puzzle.js +1 -0
- package/dist/knowledge/proof-risk.js +1 -207
- package/dist/knowledge/proof-templates.d.ts +22 -0
- package/dist/knowledge/proof-templates.js +1 -0
- package/dist/knowledge/proof-translation.js +1 -283
- package/dist/knowledge/registrar-confirm.d.ts +26 -0
- package/dist/knowledge/registrar-confirm.js +1 -0
- package/dist/knowledge/registrar-risk.js +1 -217
- package/dist/knowledge/registrar-translation.d.ts +37 -0
- package/dist/knowledge/registrar-translation.js +1 -0
- package/dist/knowledge/repository-confirm.js +1 -286
- package/dist/knowledge/repository-context.d.ts +12 -0
- package/dist/knowledge/repository-context.js +1 -0
- package/dist/knowledge/repository-ledger.d.ts +25 -0
- package/dist/knowledge/repository-ledger.js +1 -0
- package/dist/knowledge/repository-puzzle.d.ts +30 -0
- package/dist/knowledge/repository-puzzle.js +1 -0
- package/dist/knowledge/repository-risk.js +1 -373
- package/dist/knowledge/repository-templates.d.ts +14 -0
- package/dist/knowledge/repository-templates.js +1 -0
- package/dist/knowledge/repository-translation.js +1 -445
- package/dist/knowledge/reputation-rules.js +1 -99
- package/dist/knowledge/resource-confirm.d.ts +25 -0
- package/dist/knowledge/resource-confirm.js +1 -0
- package/dist/knowledge/resource-risk.js +1 -157
- package/dist/knowledge/resource-translation.d.ts +37 -0
- package/dist/knowledge/resource-translation.js +1 -0
- package/dist/knowledge/reward-confirm.js +1 -526
- package/dist/knowledge/reward-context.d.ts +2 -2
- 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.d.ts +1 -0
- 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.d.ts +1 -1
- package/dist/knowledge/service-risk.js +1 -651
- package/dist/knowledge/service-templates.js +1 -456
- package/dist/knowledge/service-translation.js +1 -622
- package/dist/knowledge/template-registry.js +1 -353
- package/dist/knowledge/tool-constraints.js +1 -195
- package/dist/knowledge/tools-reference.js +1 -178
- 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/universal-template.d.ts +22 -0
- package/dist/knowledge/universal-template.js +1 -0
- package/dist/knowledge/util-confirm.d.ts +24 -0
- package/dist/knowledge/util-confirm.js +1 -0
- package/dist/knowledge/util-risk.js +1 -135
- package/dist/knowledge/util-translation.d.ts +38 -0
- package/dist/knowledge/util-translation.js +1 -0
- package/dist/knowledge/workflow-guidance.d.ts +116 -0
- package/dist/knowledge/workflow-guidance.js +1 -0
- 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/employee-kpi.d.ts +25 -0
- package/dist/participation/employee-kpi.js +1 -0
- package/dist/participation/employee-store.d.ts +16 -0
- package/dist/participation/employee-store.js +1 -0
- package/dist/participation/index.d.ts +2 -0
- package/dist/participation/index.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.js +1 -66
- package/dist/persona/bridge.js +1 -86
- package/dist/persona/defaults.js +1 -195
- package/dist/persona/experience-bridge.js +1 -23
- package/dist/persona/index.d.ts +9 -2
- package/dist/persona/index.js +1 -71
- package/dist/persona/local-region.d.ts +20 -0
- package/dist/persona/local-region.js +1 -0
- package/dist/persona/model.js +1 -111
- package/dist/persona/overrides.d.ts +10 -0
- package/dist/persona/overrides.js +1 -0
- package/dist/persona/pack-personae.d.ts +11 -0
- package/dist/persona/pack-personae.js +1 -0
- package/dist/persona/store.js +1 -62
- package/dist/persona/strategy-intent.d.ts +20 -0
- package/dist/persona/strategy-intent.js +1 -0
- package/dist/persona/types.d.ts +6 -2
- package/dist/persona/types.js +1 -5
- package/dist/project/business-puzzle.d.ts +1 -1
- 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.d.ts +37 -1
- 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.d.ts +3 -6
- package/dist/project/graph.js +1 -340
- package/dist/project/handlers.d.ts +33 -2
- package/dist/project/handlers.js +1 -1784
- package/dist/project/index.d.ts +2 -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.d.ts +19 -0
- 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.d.ts +3 -5
- package/dist/project/semantic-graph.js +1 -292
- 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/project/workflow-design-assessment.d.ts +24 -0
- package/dist/project/workflow-design-assessment.js +1 -0
- 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.js +1 -52
- package/dist/safety/confirm-gate.d.ts +1 -1
- 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.d.ts +186 -1385
- package/dist/schema/call/allocation.js +1 -34
- package/dist/schema/call/arbitration.d.ts +272 -1871
- package/dist/schema/call/arbitration.js +1 -113
- package/dist/schema/call/base.d.ts +1831 -9076
- package/dist/schema/call/base.js +1 -370
- package/dist/schema/call/bridge.d.ts +911 -3171
- package/dist/schema/call/bridge.js +1 -458
- package/dist/schema/call/contact.d.ts +135 -931
- package/dist/schema/call/contact.js +1 -37
- package/dist/schema/call/demand.d.ts +164 -1194
- package/dist/schema/call/demand.js +1 -47
- package/dist/schema/call/guard.d.ts +298 -1140
- 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.d.ts +459 -5403
- package/dist/schema/call/machine.js +1 -193
- package/dist/schema/call/order.d.ts +137 -844
- package/dist/schema/call/order.js +1 -35
- package/dist/schema/call/payment.d.ts +74 -561
- package/dist/schema/call/payment.js +1 -37
- package/dist/schema/call/permission-handler.js +1 -54
- package/dist/schema/call/permission.d.ts +335 -2791
- package/dist/schema/call/permission.js +1 -105
- package/dist/schema/call/personal.d.ts +227 -1814
- package/dist/schema/call/personal.js +1 -78
- package/dist/schema/call/progress.d.ts +140 -843
- package/dist/schema/call/progress.js +1 -47
- package/dist/schema/call/proof.d.ts +42 -258
- package/dist/schema/call/proof.js +1 -33
- package/dist/schema/call/repository.d.ts +324 -2222
- package/dist/schema/call/repository.js +1 -77
- package/dist/schema/call/reward.d.ts +153 -1183
- package/dist/schema/call/reward.js +1 -30
- package/dist/schema/call/semantic.js +1 -1679
- package/dist/schema/call/service.d.ts +376 -3431
- package/dist/schema/call/service.js +1 -184
- package/dist/schema/call/treasury.d.ts +252 -2158
- package/dist/schema/call/treasury.js +1 -71
- package/dist/schema/common/index.d.ts +222 -697
- package/dist/schema/common/index.js +1 -407
- package/dist/schema/config/index.d.ts +18 -161
- package/dist/schema/config/index.js +1 -68
- package/dist/schema/employee/index.d.ts +99 -0
- package/dist/schema/employee/index.js +1 -0
- package/dist/schema/evaluation/index.d.ts +1062 -3748
- package/dist/schema/evaluation/index.js +1 -356
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.js +1 -17
- package/dist/schema/industry-pack/index.d.ts +132 -0
- package/dist/schema/industry-pack/index.js +1 -0
- package/dist/schema/intent-radar/index.d.ts +92 -245
- package/dist/schema/intent-radar/index.js +1 -89
- package/dist/schema/local/index.d.ts +2045 -18080
- package/dist/schema/local/index.js +1 -927
- package/dist/schema/local/wip.d.ts +61 -651
- package/dist/schema/local/wip.js +1 -187
- package/dist/schema/messenger/index.d.ts +949 -5557
- package/dist/schema/messenger/index.js +1 -475
- package/dist/schema/operations.d.ts +2969 -26518
- package/dist/schema/operations.js +1 -520
- package/dist/schema/persona/index.d.ts +469 -1820
- package/dist/schema/persona/index.js +1 -148
- package/dist/schema/project/index.d.ts +1027 -8408
- package/dist/schema/project/index.js +1 -2057
- package/dist/schema/query/index.d.ts +12041 -75261
- package/dist/schema/query/index.js +1 -1646
- package/dist/schema/schema-query/index.d.ts +35 -98
- package/dist/schema/schema-query/index.js +1 -104
- package/dist/schema/schema-version.js +1 -76
- package/dist/schema/task-status.d.ts +26 -132
- package/dist/schema/task-status.js +1 -36
- package/dist/schema/trust/index.d.ts +194 -1290
- 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.d.ts +1 -0
- package/dist/schema/utils/skills-recommendation.js +1 -77
- package/dist/schema/workspace/index.d.ts +69 -0
- package/dist/schema/workspace/index.js +1 -0
- package/dist/schema-query-impl/index.js +1 -0
- package/dist/schemas/account_operation.output.json +3147 -1652
- package/dist/schemas/account_operation.schema.json +225 -218
- package/dist/schemas/bridge_operation.output.json +1168 -650
- package/dist/schemas/bridge_operation.schema.json +736 -504
- package/dist/schemas/config_operation.output.json +185 -179
- package/dist/schemas/config_operation.schema.json +21 -26
- package/dist/schemas/employee_operation.output.json +207 -0
- package/dist/schemas/employee_operation.schema.json +176 -0
- package/dist/schemas/evaluation_operation.output.json +2329 -557
- package/dist/schemas/evaluation_operation.schema.json +2939 -720
- package/dist/schemas/guard2file.output.json +58 -64
- package/dist/schemas/guard2file.schema.json +79 -81
- package/dist/schemas/index.json +29 -11
- package/dist/schemas/industry_pack_operation.output.json +594 -0
- package/dist/schemas/industry_pack_operation.schema.json +55 -0
- package/dist/schemas/intent_radar.output.json +275 -200
- package/dist/schemas/intent_radar.schema.json +124 -123
- package/dist/schemas/local_info_operation.output.json +1174 -657
- package/dist/schemas/local_info_operation.schema.json +119 -125
- package/dist/schemas/local_mark_operation.output.json +1239 -689
- package/dist/schemas/local_mark_operation.schema.json +91 -96
- package/dist/schemas/machineNode2file.output.json +63 -69
- package/dist/schemas/machineNode2file.schema.json +79 -81
- package/dist/schemas/messenger_operation.output.json +2722 -1528
- package/dist/schemas/messenger_operation.schema.json +1482 -1264
- package/dist/schemas/onchain_events.output.json +2590 -975
- package/dist/schemas/onchain_events.schema.json +117 -99
- package/dist/schemas/onchain_operations.output.json +3957 -2309
- package/dist/schemas/onchain_operations.schema.json +20799 -9285
- package/dist/schemas/onchain_operations_allocation.schema.json +172 -108
- package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
- package/dist/schemas/onchain_operations_contact.schema.json +129 -90
- package/dist/schemas/onchain_operations_demand.schema.json +170 -112
- package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
- package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
- package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
- package/dist/schemas/onchain_operations_machine.schema.json +537 -164
- package/dist/schemas/onchain_operations_order.schema.json +126 -96
- package/dist/schemas/onchain_operations_payment.schema.json +82 -67
- package/dist/schemas/onchain_operations_permission.schema.json +331 -93
- package/dist/schemas/onchain_operations_personal.schema.json +636 -96
- package/dist/schemas/onchain_operations_progress.schema.json +125 -92
- package/dist/schemas/onchain_operations_proof.schema.json +76 -69
- package/dist/schemas/onchain_operations_repository.schema.json +636 -249
- package/dist/schemas/onchain_operations_reward.schema.json +218 -108
- package/dist/schemas/onchain_operations_service.schema.json +679 -221
- package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
- package/dist/schemas/onchain_table_data.output.json +6018 -2430
- package/dist/schemas/onchain_table_data.schema.json +544 -430
- package/dist/schemas/persona_operation.output.json +1568 -265
- package/dist/schemas/persona_operation.schema.json +346 -202
- package/dist/schemas/project_operation.output.json +6957 -5147
- package/dist/schemas/project_operation.schema.json +1050 -1020
- package/dist/schemas/query_task_status.output.json +195 -99
- package/dist/schemas/query_task_status.schema.json +12 -18
- package/dist/schemas/query_toolkit.output.json +18870 -14566
- package/dist/schemas/query_toolkit.schema.json +614 -522
- package/dist/schemas/schema_query.output.json +127 -129
- package/dist/schemas/schema_query.schema.json +64 -69
- package/dist/schemas/trust_score.output.json +678 -587
- package/dist/schemas/trust_score.schema.json +289 -277
- package/dist/schemas/wip_file.output.json +116 -124
- package/dist/schemas/wip_file.schema.json +142 -143
- package/dist/schemas/workspace_operation.output.json +277 -0
- package/dist/schemas/workspace_operation.schema.json +45 -0
- package/dist/schemas/wowok_buildin_info.output.json +1693 -723
- package/dist/schemas/wowok_buildin_info.schema.json +576 -512
- 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.d.ts +8 -1
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -74
- package/dist/tools/handlers/employee.d.ts +2 -0
- package/dist/tools/handlers/employee.js +1 -0
- package/dist/tools/handlers/evaluation.js +1 -123
- package/dist/tools/handlers/file-export.js +1 -90
- package/dist/tools/handlers/industry-pack.d.ts +2 -0
- package/dist/tools/handlers/industry-pack.js +1 -0
- package/dist/tools/handlers/intent-radar.js +1 -76
- package/dist/tools/handlers/local.js +1 -53
- package/dist/tools/handlers/messenger.js +1 -188
- package/dist/tools/handlers/onchain.js +1 -1180
- package/dist/tools/handlers/persona.js +1 -89
- 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.js +1 -26
- package/dist/tools/handlers/trust.js +1 -380
- package/dist/tools/handlers/wip.js +1 -90
- package/dist/tools/handlers/workspace.d.ts +2 -0
- package/dist/tools/handlers/workspace.js +1 -0
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +1 -1382
- package/dist/tools/retry.js +1 -85
- package/dist/tools/rules-hook.d.ts +1 -1
- package/dist/tools/rules-hook.js +1 -23
- package/dist/tools/shared.d.ts +1 -1
- package/dist/tools/shared.js +1 -130
- package/dist/tools/types.d.ts +2 -1
- 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.js +1 -306
- package/dist/tools/wrap.js +1 -500
- package/package.json +7 -6
- package/dist/knowledge/arbitration-trust.d.ts +0 -24
- package/dist/knowledge/arbitration-trust.js +0 -117
- package/dist/schema/call/bridge-handler.d.ts +0 -8
- package/dist/schema/call/bridge-handler.js +0 -265
- package/dist/schema/sync-layer4.d.ts +0 -21
- package/dist/schema/sync-layer4.js +0 -286
- package/dist/schema-query/index.js +0 -810
- /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
|
@@ -1,211 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
export const CONCEPT_GLOSSARY = [
|
|
3
|
-
{
|
|
4
|
-
term: "Permission",
|
|
5
|
-
definition: `Organization-wide permission object. indices 0-${USER_DEFINED_PERM_INDEX_START - 1} builtin, ` +
|
|
6
|
-
`${USER_DEFINED_PERM_INDEX_START}-65535 custom. ` +
|
|
7
|
-
"Shared across all Progress instances of a Service. Use for internal staff roles.",
|
|
8
|
-
aliases: ["permission object"],
|
|
9
|
-
category: "permission",
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
term: "NamedOperator",
|
|
13
|
-
definition: "Per-order role assignment inside a Progress. Each Progress node can map a role " +
|
|
14
|
-
"string to an address. Use for external collaborators whose identity varies per order.",
|
|
15
|
-
aliases: ["named operator", "namedoperator"],
|
|
16
|
-
category: "permission",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
term: "OrderHolder",
|
|
20
|
-
definition: "The order holder and their agents. Represented by namedOperator=\"\" (empty string) " +
|
|
21
|
-
"on a Forward. Lets the customer operate their own order.",
|
|
22
|
-
aliases: ["order owner", "orderholder", "order holder"],
|
|
23
|
-
category: "permission",
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
term: "Forward",
|
|
27
|
-
definition: "A state-transition edge in a Machine. Carries weight, a permission " +
|
|
28
|
-
"(Permission index / NamedOperator / OrderHolder), and an optional Guard. " +
|
|
29
|
-
"Every Forward MUST define at least one permission.",
|
|
30
|
-
aliases: ["transition"],
|
|
31
|
-
category: "operation",
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
term: "Pair",
|
|
35
|
-
definition: "A prev_node → next_node transition group in a Machine with a threshold. " +
|
|
36
|
-
"When the cumulative weight of executed Forwards meets the threshold, the Pair fires.",
|
|
37
|
-
aliases: ["transition pair"],
|
|
38
|
-
category: "operation",
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
term: "Machine",
|
|
42
|
-
definition: "Workflow blueprint (directed graph). Becomes immutable after publish. " +
|
|
43
|
-
"A Progress instance is created per order from the Machine.",
|
|
44
|
-
aliases: ["machine template"],
|
|
45
|
-
category: "object",
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
term: "Progress",
|
|
49
|
-
definition: "A workflow instance bound to one order. Advances via Forwards; " +
|
|
50
|
-
"carries retained_submission values for Guard verification.",
|
|
51
|
-
aliases: ["progress instance"],
|
|
52
|
-
category: "object",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
term: "Guard",
|
|
56
|
-
definition: "Immutable static validation rule. Verifies submissions and on-chain object data. " +
|
|
57
|
-
"Returns boolean. Cannot be mutated after creation.",
|
|
58
|
-
aliases: ["guard object"],
|
|
59
|
-
category: "acceptance",
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
term: "Repository",
|
|
63
|
-
definition: "Mutable dynamic acceptance store. Keyed by (name, entity). " +
|
|
64
|
-
"Used for data that can change over time (e.g. SLA config, review records).",
|
|
65
|
-
aliases: ["repository object"],
|
|
66
|
-
category: "acceptance",
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
term: "Acceptance",
|
|
70
|
-
definition: "The verification standard for a process step. Composed of static Guard + " +
|
|
71
|
-
"dynamic Repository. Drives whether a Forward can execute.",
|
|
72
|
-
aliases: ["acceptance standard"],
|
|
73
|
-
category: "acceptance",
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
term: "Service",
|
|
77
|
-
definition: "A merchant's service listing. References Machine, order_allocators, arbitrations, " +
|
|
78
|
-
"compensation_fund, rewards, buy_guard. machine & order_allocators lock after publish.",
|
|
79
|
-
aliases: ["service object"],
|
|
80
|
-
category: "object",
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
term: "Order",
|
|
84
|
-
definition: "An order against a Service. Funds are escrowed; released via Progress + Allocation. " +
|
|
85
|
-
"Arb cases attach to orders for dispute resolution.",
|
|
86
|
-
aliases: ["order instance"],
|
|
87
|
-
category: "object",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
term: "Allocator",
|
|
91
|
-
definition: "Fund distribution rules. Priority: Amount → Rate → Surplus. first-Guard-wins. " +
|
|
92
|
-
"Locked on Service publish (order_allocators).",
|
|
93
|
-
aliases: ["allocation"],
|
|
94
|
-
category: "fund",
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
term: "Allocation",
|
|
98
|
-
definition: "The act of distributing escrowed funds to recipients per an Allocator. " +
|
|
99
|
-
"Executed by the order holder or Permission holder.",
|
|
100
|
-
aliases: ["allocation act"],
|
|
101
|
-
category: "fund",
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
term: "Arbitration",
|
|
105
|
-
definition: "Independent arbitration service object. Configured with voting_guard, usage_guard, " +
|
|
106
|
-
"fee. Generates Arb cases per dispute. Third-party preferred over self-built.",
|
|
107
|
-
aliases: ["arb service"],
|
|
108
|
-
category: "object",
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
term: "Arb",
|
|
112
|
-
definition: "A single dispute case instance of an Arbitration. Has a state machine " +
|
|
113
|
-
"(dispute → confirm → vote → verdict → settle).",
|
|
114
|
-
aliases: ["arb case"],
|
|
115
|
-
category: "object",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
term: "compensation_fund",
|
|
119
|
-
definition: "A fund attached to a Service. Arbitration indemnity is drawn from it. " +
|
|
120
|
-
"Adequacy is a key trust signal for customers.",
|
|
121
|
-
aliases: ["compensation fund"],
|
|
122
|
-
category: "fund",
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
term: "buy_guard",
|
|
126
|
-
definition: "A Guard attached to a Service that gates purchasing. Validates customer eligibility.",
|
|
127
|
-
aliases: ["buy guard"],
|
|
128
|
-
category: "acceptance",
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
term: "Sub-Order",
|
|
132
|
-
definition: "A child order in a cross-Machine supply chain. Introduced at a node with transparent " +
|
|
133
|
-
"suppliers; verified by Guard to originate from one of the declared suppliers.",
|
|
134
|
-
aliases: ["suborder", "sub order"],
|
|
135
|
-
category: "object",
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
term: "Reward",
|
|
139
|
-
definition: "Incentive pool. claim is Guard-gated. guard_add supports Fixed or GuardU64Identifier " +
|
|
140
|
-
"(dynamic). Used for marketing (first-order, cumulative, referral).",
|
|
141
|
-
aliases: ["reward pool"],
|
|
142
|
-
category: "fund",
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
term: "Demand",
|
|
146
|
-
definition: "A user's posted service request with optional reward. presenters submit proposals; " +
|
|
147
|
-
"Guard filters them. Matches Services for personalized acquisition.",
|
|
148
|
-
aliases: ["demand request"],
|
|
149
|
-
category: "object",
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
term: "Personal",
|
|
153
|
-
definition: "Permanently public on-chain identity profile. Social links, reputation (likes/dislikes), " +
|
|
154
|
-
"personal info records. CRITICAL: everything here is PUBLIC forever.",
|
|
155
|
-
aliases: ["personal profile"],
|
|
156
|
-
category: "object",
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
term: "Contact",
|
|
160
|
-
definition: "Bridges a Service's um (contact) and the Messenger ims (messaging). Enables " +
|
|
161
|
-
"off-chain encrypted communication for pre-order negotiation & evidence.",
|
|
162
|
-
aliases: ["contact bridge"],
|
|
163
|
-
category: "object",
|
|
164
|
-
},
|
|
165
|
-
];
|
|
166
|
-
const ALIAS_INDEX = (() => {
|
|
167
|
-
const m = new Map();
|
|
168
|
-
for (const e of CONCEPT_GLOSSARY) {
|
|
169
|
-
m.set(e.term.toLowerCase(), e.term);
|
|
170
|
-
for (const a of e.aliases)
|
|
171
|
-
m.set(a.toLowerCase(), e.term);
|
|
172
|
-
}
|
|
173
|
-
return m;
|
|
174
|
-
})();
|
|
175
|
-
export function resolveTerm(alias) {
|
|
176
|
-
if (!alias)
|
|
177
|
-
return alias;
|
|
178
|
-
return ALIAS_INDEX.get(alias.toLowerCase()) ?? alias;
|
|
179
|
-
}
|
|
180
|
-
export function lookupEntry(term) {
|
|
181
|
-
const t = term.toLowerCase();
|
|
182
|
-
return CONCEPT_GLOSSARY.find((e) => e.term.toLowerCase() === t || e.aliases.some((a) => a.toLowerCase() === t));
|
|
183
|
-
}
|
|
184
|
-
export function validateText(text) {
|
|
185
|
-
const findings = [];
|
|
186
|
-
if (!text)
|
|
187
|
-
return findings;
|
|
188
|
-
const lower = text.toLowerCase();
|
|
189
|
-
for (const entry of CONCEPT_GLOSSARY) {
|
|
190
|
-
for (const alias of entry.aliases) {
|
|
191
|
-
const a = alias.toLowerCase();
|
|
192
|
-
if (entry.term.toLowerCase() === a)
|
|
193
|
-
continue;
|
|
194
|
-
if (lower.includes(a)) {
|
|
195
|
-
findings.push({ alias, canonical: entry.term });
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return findings;
|
|
200
|
-
}
|
|
201
|
-
export function auditSchemaFields(obj) {
|
|
202
|
-
const findings = [];
|
|
203
|
-
for (const key of Object.keys(obj)) {
|
|
204
|
-
const canonical = ALIAS_INDEX.get(key.toLowerCase());
|
|
205
|
-
if (canonical && canonical !== key) {
|
|
206
|
-
findings.push({ alias: key, canonical });
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
return findings;
|
|
210
|
-
}
|
|
211
|
-
export const CONCEPT_GLOSSARY_VERSION = 1;
|
|
1
|
+
import{USER_DEFINED_PERM_INDEX_START}from'./onchain-constants.js';export const CONCEPT_GLOSSARY=[{'term':'Permission','definition':'Organization-wide\x20permission\x20object.\x20indices\x200-'+(USER_DEFINED_PERM_INDEX_START-0x1)+'\x20builtin,\x20'+(USER_DEFINED_PERM_INDEX_START+'-65535\x20custom.\x20')+'Shared\x20across\x20all\x20Progress\x20instances\x20of\x20a\x20Service.\x20Use\x20for\x20internal\x20staff\x20roles.','aliases':['permission\x20object'],'category':'permission'},{'term':'NamedOperator','definition':'Per-order\x20role\x20assignment\x20inside\x20a\x20Progress.\x20Each\x20Progress\x20node\x20can\x20map\x20a\x20role\x20'+'string\x20to\x20an\x20address.\x20Use\x20for\x20external\x20collaborators\x20whose\x20identity\x20varies\x20per\x20order.','aliases':['named\x20operator','namedoperator'],'category':'permission'},{'term':'OrderHolder','definition':'The\x20order\x20holder\x20and\x20their\x20agents.\x20Represented\x20by\x20namedOperator=\x22\x22\x20(empty\x20string)\x20'+'on\x20a\x20Forward.\x20Lets\x20the\x20customer\x20operate\x20their\x20own\x20order.','aliases':['order\x20owner','orderholder','order\x20holder'],'category':'permission'},{'term':'Forward','definition':'A\x20state-transition\x20edge\x20in\x20a\x20Machine.\x20Carries\x20weight,\x20a\x20permission\x20'+'(Permission\x20index\x20/\x20NamedOperator\x20/\x20OrderHolder),\x20and\x20an\x20optional\x20Guard.\x20'+'Every\x20Forward\x20MUST\x20define\x20at\x20least\x20one\x20permission.','aliases':['transition'],'category':'operation'},{'term':'Pair','definition':'A\x20prev_node\x20→\x20next_node\x20transition\x20group\x20in\x20a\x20Machine\x20with\x20a\x20threshold.\x20'+'When\x20the\x20cumulative\x20weight\x20of\x20executed\x20Forwards\x20meets\x20the\x20threshold,\x20the\x20Pair\x20fires.','aliases':['transition\x20pair'],'category':'operation'},{'term':'Machine','definition':'Workflow\x20blueprint\x20(directed\x20graph).\x20Becomes\x20immutable\x20after\x20publish.\x20'+'A\x20Progress\x20instance\x20is\x20created\x20per\x20order\x20from\x20the\x20Machine.','aliases':['machine\x20template'],'category':'object'},{'term':'Progress','definition':'A\x20workflow\x20instance\x20bound\x20to\x20one\x20order.\x20Advances\x20via\x20Forwards;\x20'+'carries\x20retained_submission\x20values\x20for\x20Guard\x20verification.','aliases':['progress\x20instance'],'category':'object'},{'term':'Guard','definition':'Immutable\x20static\x20validation\x20rule.\x20Verifies\x20submissions\x20and\x20on-chain\x20object\x20data.\x20'+'Returns\x20boolean.\x20Cannot\x20be\x20mutated\x20after\x20creation.','aliases':['guard\x20object'],'category':'acceptance'},{'term':'Repository','definition':'Mutable\x20dynamic\x20acceptance\x20store.\x20Keyed\x20by\x20(name,\x20entity).\x20'+'Used\x20for\x20data\x20that\x20can\x20change\x20over\x20time\x20(e.g.\x20SLA\x20config,\x20review\x20records).','aliases':['repository\x20object'],'category':'acceptance'},{'term':'Acceptance','definition':'The\x20verification\x20standard\x20for\x20a\x20process\x20step.\x20Composed\x20of\x20static\x20Guard\x20+\x20'+'dynamic\x20Repository.\x20Drives\x20whether\x20a\x20Forward\x20can\x20execute.','aliases':['acceptance\x20standard'],'category':'acceptance'},{'term':'Service','definition':'A\x20merchant\x27s\x20service\x20listing.\x20References\x20Machine,\x20order_allocators,\x20arbitrations,\x20'+'compensation_fund,\x20rewards,\x20buy_guard.\x20machine\x20&\x20order_allocators\x20lock\x20after\x20publish.','aliases':['service\x20object'],'category':'object'},{'term':'Order','definition':'An\x20order\x20against\x20a\x20Service.\x20Funds\x20are\x20escrowed;\x20released\x20via\x20Progress\x20+\x20Allocation.\x20'+'Arb\x20cases\x20attach\x20to\x20orders\x20for\x20dispute\x20resolution.','aliases':['order\x20instance'],'category':'object'},{'term':'Allocator','definition':'Fund\x20distribution\x20rules.\x20Priority:\x20Amount\x20→\x20Rate\x20→\x20Surplus.\x20first-Guard-wins.\x20'+'Locked\x20on\x20Service\x20publish\x20(order_allocators).','aliases':['allocation'],'category':'fund'},{'term':'Allocation','definition':'The\x20act\x20of\x20distributing\x20escrowed\x20funds\x20to\x20recipients\x20per\x20an\x20Allocator.\x20'+'Executed\x20by\x20the\x20order\x20holder\x20or\x20Permission\x20holder.','aliases':['allocation\x20act'],'category':'fund'},{'term':'Arbitration','definition':'Independent\x20arbitration\x20service\x20object.\x20Configured\x20with\x20voting_guard,\x20usage_guard,\x20'+'fee.\x20Generates\x20Arb\x20cases\x20per\x20dispute.\x20Third-party\x20preferred\x20over\x20self-built.','aliases':['arb\x20service'],'category':'object'},{'term':'Arb','definition':'A\x20single\x20dispute\x20case\x20instance\x20of\x20an\x20Arbitration.\x20Has\x20a\x20state\x20machine\x20'+'(dispute\x20→\x20confirm\x20→\x20vote\x20→\x20verdict\x20→\x20settle).','aliases':['arb\x20case'],'category':'object'},{'term':'compensation_fund','definition':'A\x20fund\x20attached\x20to\x20a\x20Service.\x20Arbitration\x20indemnity\x20is\x20drawn\x20from\x20it.\x20'+'Adequacy\x20is\x20a\x20key\x20trust\x20signal\x20for\x20customers.','aliases':['compensation\x20fund'],'category':'fund'},{'term':'buy_guard','definition':'A\x20Guard\x20attached\x20to\x20a\x20Service\x20that\x20gates\x20purchasing.\x20Validates\x20customer\x20eligibility.','aliases':['buy\x20guard'],'category':'acceptance'},{'term':'Sub-Order','definition':'A\x20child\x20order\x20in\x20a\x20cross-Machine\x20supply\x20chain.\x20Introduced\x20at\x20a\x20node\x20with\x20transparent\x20'+'suppliers;\x20verified\x20by\x20Guard\x20to\x20originate\x20from\x20one\x20of\x20the\x20declared\x20suppliers.','aliases':['suborder','sub\x20order'],'category':'object'},{'term':'Reward','definition':'Incentive\x20pool.\x20claim\x20is\x20Guard-gated.\x20guard_add\x20supports\x20Fixed\x20or\x20GuardU64Identifier\x20'+'(dynamic).\x20Used\x20for\x20marketing\x20(first-order,\x20cumulative,\x20referral).','aliases':['reward\x20pool'],'category':'fund'},{'term':'Demand','definition':'A\x20user\x27s\x20posted\x20service\x20request\x20with\x20optional\x20reward.\x20presenters\x20submit\x20proposals;\x20'+'Guard\x20filters\x20them.\x20Matches\x20Services\x20for\x20personalized\x20acquisition.','aliases':['demand\x20request'],'category':'object'},{'term':'Personal','definition':'Permanently\x20public\x20on-chain\x20identity\x20profile.\x20Social\x20links,\x20reputation\x20(likes/dislikes),\x20'+'personal\x20info\x20records.\x20CRITICAL:\x20everything\x20here\x20is\x20PUBLIC\x20forever.','aliases':['personal\x20profile'],'category':'object'},{'term':'Contact','definition':'Bridges\x20a\x20Service\x27s\x20um\x20(contact)\x20and\x20the\x20Messenger\x20ims\x20(messaging).\x20Enables\x20'+'off-chain\x20encrypted\x20communication\x20for\x20pre-order\x20negotiation\x20&\x20evidence.','aliases':['contact\x20bridge'],'category':'object'}];const ALIAS_INDEX=((()=>{const b=new Map();for(const c of CONCEPT_GLOSSARY){b['set'](c['term']['toLowerCase'](),c['term']);for(const d of c['aliases'])b['set'](d['toLowerCase'](),c['term']);}return b;})());export function resolveTerm(a){if(!a)return a;return ALIAS_INDEX['get'](a['toLowerCase']())??a;}export function lookupEntry(a){const b=a['toLowerCase']();return CONCEPT_GLOSSARY['find'](c=>c['term']['toLowerCase']()===b||c['aliases']['some'](d=>d['toLowerCase']()===b));}export function validateText(b){const c=[];if(!b)return c;const d=b['toLowerCase']();for(const e of CONCEPT_GLOSSARY){for(const f of e['aliases']){const g=f['toLowerCase']();if(e['term']['toLowerCase']()===g)continue;d['includes'](g)&&c['push']({'alias':f,'canonical':e['term']});}}return c;}export function auditSchemaFields(a){const b=[];for(const c of Object['keys'](a)){const d=ALIAS_INDEX['get'](c['toLowerCase']());d&&d!==c&&b['push']({'alias':c,'canonical':d});}return b;}export const CONCEPT_GLOSSARY_VERSION=0x1;
|
|
@@ -1,406 +1 @@
|
|
|
1
|
-
import { assessGuardRisks, } from "./guard-risk.js";
|
|
2
|
-
import { GUARD_SCENES, } from "./guard-ledger.js";
|
|
3
|
-
export const GUARD_PUBLISH_CHECKLIST = [
|
|
4
|
-
{
|
|
5
|
-
id: "GC-01",
|
|
6
|
-
description: "Root node exists and is a valid GuardNode type",
|
|
7
|
-
status: "skip",
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
id: "GC-02",
|
|
11
|
-
description: "All table entries have valid value_type (0-18)",
|
|
12
|
-
status: "skip",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: "GC-03",
|
|
16
|
-
description: "Table size within MAX_TABLE_SIZE limit",
|
|
17
|
-
status: "skip",
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: "GC-04",
|
|
21
|
-
description: "Description length within MAX_DESCRIPTION_LENGTH",
|
|
22
|
-
status: "skip",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: "GC-05",
|
|
26
|
-
description: "Binding scene identified (one of 8 scenes) or Standalone",
|
|
27
|
-
status: "skip",
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
id: "GC-06",
|
|
31
|
-
description: "All query nodes reference valid GUARDQUERY instructions",
|
|
32
|
-
status: "skip",
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: "GC-07",
|
|
36
|
-
description: "All witness nodes use valid WitnessType (100-108)",
|
|
37
|
-
status: "skip",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
id: "GC-08",
|
|
41
|
-
description: "No circular rely chain in root tree",
|
|
42
|
-
status: "skip",
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
id: "GC-09",
|
|
46
|
-
description: "Type compatibility verified for all equal/compare nodes",
|
|
47
|
-
status: "skip",
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
id: "GC-10",
|
|
51
|
-
description: "Context nodes (Signer/Clock/Guard) used with correct semantics",
|
|
52
|
-
status: "skip",
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
id: "GC-11",
|
|
56
|
-
description: "Submission data (b_submission=true) marked as Type3 with forgery risk evaluated",
|
|
57
|
-
status: "skip",
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: "GC-12",
|
|
61
|
-
description: "Immutability acknowledged — Guard CANNOT be modified after creation",
|
|
62
|
-
status: "skip",
|
|
63
|
-
},
|
|
64
|
-
];
|
|
65
|
-
export const GUARD_CONFIRMATION_QUESTIONS = [
|
|
66
|
-
{
|
|
67
|
-
id: "QG1",
|
|
68
|
-
question: "Have you verified that the Guard's validation rule matches your business intent (e.g., 'customer must have paid' rather than 'customer must NOT have paid')?",
|
|
69
|
-
expected_response: "yes",
|
|
70
|
-
blocking: true,
|
|
71
|
-
explanation: "Inverted logic is the #1 cause of Guard failures. The rule_sentence in your puzzle should match the on-chain enforcement direction.",
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
id: "QG2",
|
|
75
|
-
question: "Have you confirmed that all Type3 (b_submission=true) data sources are forgery-resistant (submitted by trusted callers, not user-supplied)?",
|
|
76
|
-
expected_response: "yes",
|
|
77
|
-
blocking: true,
|
|
78
|
-
explanation: "Type3 data is the most common attack vector. If users can submit arbitrary values, the Guard is bypassable.",
|
|
79
|
-
},
|
|
80
|
-
{
|
|
81
|
-
id: "QG3",
|
|
82
|
-
question: "Have you tested the Guard on testnet with gen_passport to verify it returns the expected pass/fail result for both valid and invalid inputs?",
|
|
83
|
-
expected_response: "yes",
|
|
84
|
-
blocking: true,
|
|
85
|
-
explanation: "gen_passport is the only way to test Guard evaluation without binding it. Skipping this risks publishing a broken Guard.",
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
id: "QG4",
|
|
89
|
-
question: "Is the binding target (Service/Machine/Reward/etc.) already published or planned in the same deployment batch?",
|
|
90
|
-
expected_response: "yes",
|
|
91
|
-
blocking: false,
|
|
92
|
-
explanation: "Guard can be created standalone, but its binding field expects an existing object. Plan creation order accordingly.",
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
id: "QG5",
|
|
96
|
-
question: "Are you aware that this Guard is IMMUTABLE after creation and cannot be modified (only a new version can be created)?",
|
|
97
|
-
expected_response: "yes",
|
|
98
|
-
blocking: true,
|
|
99
|
-
explanation: "Unlike Machine (which allows permission changes), Guard has NO update entry point. Review the rule twice before confirming.",
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
id: "QG6",
|
|
103
|
-
question: "Have you reviewed the game-theory implications — does this Guard favor one stakeholder (customer/provider/arbitrator) unfairly?",
|
|
104
|
-
expected_response: "no",
|
|
105
|
-
blocking: false,
|
|
106
|
-
explanation: "Answer 'no' = no unfair advantage. If 'yes', review the game_theory risk rules in guard-risk.ts and adjust.",
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
export const GUARD_CONFIRM_VERSION = "1.0.0";
|
|
110
|
-
export function runGuardConfirmGate(input) {
|
|
111
|
-
const decision_record = {
|
|
112
|
-
final_decision: "blocked",
|
|
113
|
-
timestamp: new Date().toISOString(),
|
|
114
|
-
layers_passed: [],
|
|
115
|
-
};
|
|
116
|
-
const checklist_result = runStaticChecklist(input.guard_json, input.existing_lint_issues);
|
|
117
|
-
if (!checklist_result.passed) {
|
|
118
|
-
return {
|
|
119
|
-
status: "blocked_checklist",
|
|
120
|
-
checklist_result,
|
|
121
|
-
decision_record: {
|
|
122
|
-
...decision_record,
|
|
123
|
-
final_reason: `Layer 1 failed: ${checklist_result.failed_items.map(i => i.id).join(", ")}`,
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
decision_record.layers_passed.push("checklist");
|
|
128
|
-
let risk_result;
|
|
129
|
-
if (input.existing_risk_assessment) {
|
|
130
|
-
risk_result = adaptRiskAssessment(input.existing_risk_assessment);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
const guard_data = input.guard_json.root;
|
|
134
|
-
const assessment = assessGuardRisks({
|
|
135
|
-
table: guard_data?.table ?? [],
|
|
136
|
-
root: input.guard_json.root,
|
|
137
|
-
rely: guard_data?.rely,
|
|
138
|
-
});
|
|
139
|
-
risk_result = adaptRiskAssessment(assessment);
|
|
140
|
-
}
|
|
141
|
-
if (risk_result.recommendation === "do_not_publish") {
|
|
142
|
-
return {
|
|
143
|
-
status: "blocked_risk",
|
|
144
|
-
checklist_result,
|
|
145
|
-
risk_result,
|
|
146
|
-
decision_record: {
|
|
147
|
-
...decision_record,
|
|
148
|
-
final_reason: `Layer 2 blocked: ${risk_result.blocking_risks.length} CRITICAL risks`,
|
|
149
|
-
},
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
decision_record.layers_passed.push("risk");
|
|
153
|
-
if (!input.skip_user_confirmation) {
|
|
154
|
-
const confirmation_text = generateGuardConfirmationText(input.guard_json, checklist_result, risk_result);
|
|
155
|
-
const user_confirmation = processUserConfirmation(input.user_responses);
|
|
156
|
-
if (!user_confirmation.approved) {
|
|
157
|
-
return {
|
|
158
|
-
status: "blocked_user",
|
|
159
|
-
checklist_result,
|
|
160
|
-
risk_result,
|
|
161
|
-
confirmation_text,
|
|
162
|
-
user_confirmation,
|
|
163
|
-
decision_record: {
|
|
164
|
-
...decision_record,
|
|
165
|
-
final_reason: `Layer 3 declined: ${user_confirmation.declined_reason ?? "no reason given"}`,
|
|
166
|
-
},
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
decision_record.layers_passed.push("user");
|
|
170
|
-
if (!input.skip_environment) {
|
|
171
|
-
const environment_result = verifyGuardEnvironment(input.guard_json);
|
|
172
|
-
if (!environment_result.testnet_tested || !environment_result.rely_chain_resolvable) {
|
|
173
|
-
return {
|
|
174
|
-
status: "blocked_environment",
|
|
175
|
-
checklist_result,
|
|
176
|
-
risk_result,
|
|
177
|
-
user_confirmation,
|
|
178
|
-
environment_result,
|
|
179
|
-
decision_record: {
|
|
180
|
-
...decision_record,
|
|
181
|
-
final_reason: `Layer 4 failed: environment issues`,
|
|
182
|
-
},
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
decision_record.layers_passed.push("environment");
|
|
186
|
-
}
|
|
187
|
-
return {
|
|
188
|
-
status: "approved",
|
|
189
|
-
checklist_result,
|
|
190
|
-
risk_result,
|
|
191
|
-
user_confirmation,
|
|
192
|
-
confirmation_text: generateGuardConfirmationText(input.guard_json, checklist_result, risk_result),
|
|
193
|
-
decision_record: {
|
|
194
|
-
...decision_record,
|
|
195
|
-
final_decision: "approved",
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
decision_record.layers_passed.push("user");
|
|
200
|
-
return {
|
|
201
|
-
status: "approved",
|
|
202
|
-
checklist_result,
|
|
203
|
-
risk_result,
|
|
204
|
-
decision_record: {
|
|
205
|
-
...decision_record,
|
|
206
|
-
final_decision: "approved",
|
|
207
|
-
},
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
function runStaticChecklist(guard_json, existing_issues) {
|
|
211
|
-
const checked_items = [];
|
|
212
|
-
const failed_items = [];
|
|
213
|
-
const warnings = [];
|
|
214
|
-
for (const template of GUARD_PUBLISH_CHECKLIST) {
|
|
215
|
-
const item = { ...template, status: "skip" };
|
|
216
|
-
try {
|
|
217
|
-
const result = evaluateChecklistItem(item.id, guard_json, existing_issues);
|
|
218
|
-
item.status = result.status;
|
|
219
|
-
item.detail = result.detail;
|
|
220
|
-
if (result.status === "fail")
|
|
221
|
-
failed_items.push(item);
|
|
222
|
-
else if (result.status === "warning")
|
|
223
|
-
warnings.push(item);
|
|
224
|
-
}
|
|
225
|
-
catch (err) {
|
|
226
|
-
item.status = "warning";
|
|
227
|
-
item.detail = `Check error: ${err.message}`;
|
|
228
|
-
warnings.push(item);
|
|
229
|
-
}
|
|
230
|
-
checked_items.push(item);
|
|
231
|
-
}
|
|
232
|
-
return {
|
|
233
|
-
passed: failed_items.length === 0,
|
|
234
|
-
checked_items,
|
|
235
|
-
failed_items,
|
|
236
|
-
warnings,
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
function evaluateChecklistItem(id, guard_json, existing_issues) {
|
|
240
|
-
const root = guard_json.root;
|
|
241
|
-
switch (id) {
|
|
242
|
-
case "GC-01":
|
|
243
|
-
if (!root || !root.type)
|
|
244
|
-
return { status: "fail", detail: "Root node missing or has no type" };
|
|
245
|
-
return { status: "pass" };
|
|
246
|
-
case "GC-02":
|
|
247
|
-
case "GC-03":
|
|
248
|
-
case "GC-04": {
|
|
249
|
-
if (existing_issues && existing_issues.length > 0) {
|
|
250
|
-
const related = existing_issues.find(i => i.path?.includes("table") || i.path?.includes("description"));
|
|
251
|
-
if (related)
|
|
252
|
-
return { status: "fail", detail: related.message };
|
|
253
|
-
}
|
|
254
|
-
return { status: "pass", detail: "Validated by SDK validateGuardData" };
|
|
255
|
-
}
|
|
256
|
-
case "GC-05": {
|
|
257
|
-
if (guard_json.binding_scene_id) {
|
|
258
|
-
const scene = GUARD_SCENES.find(s => s.id === guard_json.binding_scene_id);
|
|
259
|
-
if (scene)
|
|
260
|
-
return { status: "pass", detail: `Scene: ${scene.id}` };
|
|
261
|
-
return { status: "warning", detail: `Scene ID "${guard_json.binding_scene_id}" not found in ledger` };
|
|
262
|
-
}
|
|
263
|
-
return { status: "warning", detail: "No binding scene identified — verify Standalone intent" };
|
|
264
|
-
}
|
|
265
|
-
case "GC-06":
|
|
266
|
-
case "GC-07":
|
|
267
|
-
case "GC-08":
|
|
268
|
-
case "GC-09":
|
|
269
|
-
case "GC-10":
|
|
270
|
-
case "GC-11":
|
|
271
|
-
if (existing_issues && existing_issues.some(i => i.path?.includes("query") || i.path?.includes("witness"))) {
|
|
272
|
-
return { status: "fail", detail: "SDK validation flagged query/witness issues" };
|
|
273
|
-
}
|
|
274
|
-
return { status: "pass", detail: "Delegated to guard-lint.ts" };
|
|
275
|
-
case "GC-12":
|
|
276
|
-
return { status: "pass", detail: "Immutability noted — Guard cannot be modified after creation" };
|
|
277
|
-
default:
|
|
278
|
-
return { status: "skip" };
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
function adaptRiskAssessment(assessment) {
|
|
282
|
-
const blocking_risks = [];
|
|
283
|
-
const warning_risks = [];
|
|
284
|
-
for (const risk of assessment.risks ?? []) {
|
|
285
|
-
if (risk.level === "critical")
|
|
286
|
-
blocking_risks.push(risk.id);
|
|
287
|
-
else if (risk.level === "high")
|
|
288
|
-
warning_risks.push(risk.id);
|
|
289
|
-
}
|
|
290
|
-
let recommendation = "publish";
|
|
291
|
-
if (blocking_risks.length > 0)
|
|
292
|
-
recommendation = "do_not_publish";
|
|
293
|
-
else if (warning_risks.length > 2)
|
|
294
|
-
recommendation = "fix_first";
|
|
295
|
-
return {
|
|
296
|
-
overall_risk_level: assessment.overall_risk,
|
|
297
|
-
blocking_risks,
|
|
298
|
-
warning_risks,
|
|
299
|
-
recommendation,
|
|
300
|
-
};
|
|
301
|
-
}
|
|
302
|
-
function processUserConfirmation(responses) {
|
|
303
|
-
const questions_asked = GUARD_CONFIRMATION_QUESTIONS;
|
|
304
|
-
if (!responses || responses.length === 0) {
|
|
305
|
-
return {
|
|
306
|
-
questions_asked,
|
|
307
|
-
user_responses: [],
|
|
308
|
-
approved: false,
|
|
309
|
-
declined_reason: "No user responses provided",
|
|
310
|
-
timestamp: new Date().toISOString(),
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
const blocking_questions = questions_asked.filter(q => q.blocking);
|
|
314
|
-
for (const q of blocking_questions) {
|
|
315
|
-
const response = responses.find(r => r.question_id === q.id);
|
|
316
|
-
if (!response) {
|
|
317
|
-
return {
|
|
318
|
-
questions_asked,
|
|
319
|
-
user_responses: responses,
|
|
320
|
-
approved: false,
|
|
321
|
-
declined_reason: `Blocking question ${q.id} not answered`,
|
|
322
|
-
timestamp: new Date().toISOString(),
|
|
323
|
-
};
|
|
324
|
-
}
|
|
325
|
-
if (q.expected_response === "yes" && response.response !== "yes") {
|
|
326
|
-
return {
|
|
327
|
-
questions_asked,
|
|
328
|
-
user_responses: responses,
|
|
329
|
-
approved: false,
|
|
330
|
-
declined_reason: `${q.id} expected 'yes', got '${response.response}'`,
|
|
331
|
-
timestamp: new Date().toISOString(),
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
if (q.expected_response === "no" && response.response !== "no") {
|
|
335
|
-
return {
|
|
336
|
-
questions_asked,
|
|
337
|
-
user_responses: responses,
|
|
338
|
-
approved: false,
|
|
339
|
-
declined_reason: `${q.id} expected 'no', got '${response.response}'`,
|
|
340
|
-
timestamp: new Date().toISOString(),
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
return {
|
|
345
|
-
questions_asked,
|
|
346
|
-
user_responses: responses,
|
|
347
|
-
approved: true,
|
|
348
|
-
timestamp: new Date().toISOString(),
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
function generateGuardConfirmationText(guard_json, checklist, risk) {
|
|
352
|
-
const lines = [];
|
|
353
|
-
lines.push("═══════════════════════════════════════════════════════════");
|
|
354
|
-
lines.push(" GUARD PUBLISH CONFIRMATION");
|
|
355
|
-
lines.push("═══════════════════════════════════════════════════════════");
|
|
356
|
-
lines.push(`Name: ${guard_json.name ?? "(unnamed)"}`);
|
|
357
|
-
lines.push(`Description: ${guard_json.description ?? "(none)"}`);
|
|
358
|
-
lines.push(`Binding Scene: ${guard_json.binding_scene_id ?? "Standalone"}`);
|
|
359
|
-
lines.push("");
|
|
360
|
-
lines.push("─ Layer 1: Static Checklist ─────────────────────────────");
|
|
361
|
-
lines.push(`Result: ${checklist.passed ? "✅ PASS" : "❌ FAIL"}`);
|
|
362
|
-
lines.push(`Items: ${checklist.checked_items.length} checked, ${checklist.failed_items.length} failed, ${checklist.warnings.length} warnings`);
|
|
363
|
-
lines.push("");
|
|
364
|
-
lines.push("─ Layer 2: Risk Assessment ──────────────────────────────");
|
|
365
|
-
lines.push(`Overall: ${risk.overall_risk_level.toUpperCase()}`);
|
|
366
|
-
lines.push(`Blocking: ${risk.blocking_risks.length} | Warning: ${risk.warning_risks.length}`);
|
|
367
|
-
lines.push(`Recommendation: ${risk.recommendation}`);
|
|
368
|
-
lines.push("");
|
|
369
|
-
lines.push("⚠️ CRITICAL REMINDER: Guard is IMMUTABLE after creation.");
|
|
370
|
-
lines.push(" There is NO update path. If the rule is wrong, you must");
|
|
371
|
-
lines.push(" create a NEW Guard and rebind the host object.");
|
|
372
|
-
lines.push("");
|
|
373
|
-
lines.push("Please review the above and confirm publication.");
|
|
374
|
-
lines.push("═══════════════════════════════════════════════════════════");
|
|
375
|
-
return lines.join("\n");
|
|
376
|
-
}
|
|
377
|
-
function verifyGuardEnvironment(guard_json) {
|
|
378
|
-
const warnings = [];
|
|
379
|
-
if (!guard_json.binding_target) {
|
|
380
|
-
warnings.push("No binding target specified — Guard will be Standalone (verify intent)");
|
|
381
|
-
}
|
|
382
|
-
return {
|
|
383
|
-
testnet_tested: false,
|
|
384
|
-
binding_target_exists: !!guard_json.binding_target,
|
|
385
|
-
rely_chain_resolvable: true,
|
|
386
|
-
passport_generated_successfully: false,
|
|
387
|
-
warnings,
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
export function progressiveGuardCheck(guard_json) {
|
|
391
|
-
const checklist = runStaticChecklist(guard_json);
|
|
392
|
-
if (!checklist.passed) {
|
|
393
|
-
return { layer: "checklist", result: checklist };
|
|
394
|
-
}
|
|
395
|
-
const guard_data = guard_json.root;
|
|
396
|
-
const assessment = assessGuardRisks({
|
|
397
|
-
table: guard_data?.table ?? [],
|
|
398
|
-
root: guard_json.root,
|
|
399
|
-
rely: guard_data?.rely,
|
|
400
|
-
});
|
|
401
|
-
const risk = adaptRiskAssessment(assessment);
|
|
402
|
-
if (risk.recommendation === "do_not_publish") {
|
|
403
|
-
return { layer: "risk", result: risk };
|
|
404
|
-
}
|
|
405
|
-
return { layer: "none", result: null };
|
|
406
|
-
}
|
|
1
|
+
import{assessGuardRisks}from'./guard-risk.js';import{GUARD_SCENES}from'./guard-ledger.js';export const GUARD_PUBLISH_CHECKLIST=[{'id':'GC-01','description':'Root\x20node\x20exists\x20and\x20is\x20a\x20valid\x20GuardNode\x20type','status':'skip'},{'id':'GC-02','description':'All\x20table\x20entries\x20have\x20valid\x20value_type\x20(0-18)','status':'skip'},{'id':'GC-03','description':'Table\x20size\x20within\x20MAX_TABLE_SIZE\x20limit','status':'skip'},{'id':'GC-04','description':'Description\x20length\x20within\x20MAX_DESCRIPTION_LENGTH','status':'skip'},{'id':'GC-05','description':'Binding\x20scene\x20identified\x20(one\x20of\x208\x20scenes)\x20or\x20Standalone','status':'skip'},{'id':'GC-06','description':'All\x20query\x20nodes\x20reference\x20valid\x20GUARDQUERY\x20instructions','status':'skip'},{'id':'GC-07','description':'All\x20witness\x20nodes\x20use\x20valid\x20WitnessType\x20(100-108)','status':'skip'},{'id':'GC-08','description':'No\x20circular\x20rely\x20chain\x20in\x20root\x20tree','status':'skip'},{'id':'GC-09','description':'Type\x20compatibility\x20verified\x20for\x20all\x20equal/compare\x20nodes','status':'skip'},{'id':'GC-10','description':'Context\x20nodes\x20(Signer/Clock/Guard)\x20used\x20with\x20correct\x20semantics','status':'skip'},{'id':'GC-11','description':'Submission\x20data\x20(b_submission=true)\x20marked\x20as\x20Type3\x20with\x20forgery\x20risk\x20evaluated','status':'skip'},{'id':'GC-12','description':'Immutability\x20acknowledged\x20—\x20Guard\x20CANNOT\x20be\x20modified\x20after\x20creation','status':'skip'}];export const GUARD_CONFIRMATION_QUESTIONS=[{'id':'QG1','question':'Have\x20you\x20verified\x20that\x20the\x20Guard\x27s\x20validation\x20rule\x20matches\x20your\x20business\x20intent\x20(e.g.,\x20\x27customer\x20must\x20have\x20paid\x27\x20rather\x20than\x20\x27customer\x20must\x20NOT\x20have\x20paid\x27)?','expected_response':'yes','blocking':!![],'explanation':'Inverted\x20logic\x20is\x20the\x20#1\x20cause\x20of\x20Guard\x20failures.\x20The\x20rule_sentence\x20in\x20your\x20puzzle\x20should\x20match\x20the\x20on-chain\x20enforcement\x20direction.'},{'id':'QG2','question':'Have\x20you\x20confirmed\x20that\x20all\x20Type3\x20(b_submission=true)\x20data\x20sources\x20are\x20forgery-resistant\x20(submitted\x20by\x20trusted\x20callers,\x20not\x20user-supplied)?','expected_response':'yes','blocking':!![],'explanation':'Type3\x20data\x20is\x20the\x20most\x20common\x20attack\x20vector.\x20If\x20users\x20can\x20submit\x20arbitrary\x20values,\x20the\x20Guard\x20is\x20bypassable.'},{'id':'QG3','question':'Have\x20you\x20tested\x20the\x20Guard\x20on\x20testnet\x20with\x20gen_passport\x20to\x20verify\x20it\x20returns\x20the\x20expected\x20pass/fail\x20result\x20for\x20both\x20valid\x20and\x20invalid\x20inputs?','expected_response':'yes','blocking':!![],'explanation':'gen_passport\x20is\x20the\x20only\x20way\x20to\x20test\x20Guard\x20evaluation\x20without\x20binding\x20it.\x20Skipping\x20this\x20risks\x20publishing\x20a\x20broken\x20Guard.'},{'id':'QG4','question':'Is\x20the\x20binding\x20target\x20(Service/Machine/Reward/etc.)\x20already\x20published\x20or\x20planned\x20in\x20the\x20same\x20deployment\x20batch?','expected_response':'yes','blocking':![],'explanation':'Guard\x20can\x20be\x20created\x20standalone,\x20but\x20its\x20binding\x20field\x20expects\x20an\x20existing\x20object.\x20Plan\x20creation\x20order\x20accordingly.'},{'id':'QG5','question':'Are\x20you\x20aware\x20that\x20this\x20Guard\x20is\x20IMMUTABLE\x20after\x20creation\x20and\x20cannot\x20be\x20modified\x20(only\x20a\x20new\x20version\x20can\x20be\x20created)?','expected_response':'yes','blocking':!![],'explanation':'Unlike\x20Machine\x20(which\x20allows\x20permission\x20changes),\x20Guard\x20has\x20NO\x20update\x20entry\x20point.\x20Review\x20the\x20rule\x20twice\x20before\x20confirming.'},{'id':'QG6','question':'Have\x20you\x20reviewed\x20the\x20game-theory\x20implications\x20—\x20does\x20this\x20Guard\x20favor\x20one\x20stakeholder\x20(customer/provider/arbitrator)\x20unfairly?','expected_response':'no','blocking':![],'explanation':'Answer\x20\x27no\x27\x20=\x20no\x20unfair\x20advantage.\x20If\x20\x27yes\x27,\x20review\x20the\x20game_theory\x20risk\x20rules\x20in\x20guard-risk.ts\x20and\x20adjust.'}];export const GUARD_CONFIRM_VERSION='1.0.0';export function runGuardConfirmGate(a){const b={'final_decision':'blocked','timestamp':new Date()['toISOString'](),'layers_passed':[]},c=runStaticChecklist(a['guard_json'],a['existing_lint_issues']);if(!c['passed'])return{'status':'blocked_checklist','checklist_result':c,'decision_record':{...b,'final_reason':'Layer\x201\x20failed:\x20'+c['failed_items']['map'](e=>e['id'])['join'](',\x20')}};b['layers_passed']['push']('checklist');let d;if(a['existing_risk_assessment'])d=adaptRiskAssessment(a['existing_risk_assessment']);else{const e=a['guard_json']['root'],f=assessGuardRisks({'table':e?.['table']??[],'root':a['guard_json']['root'],'rely':e?.['rely']});d=adaptRiskAssessment(f);}if(d['recommendation']==='do_not_publish')return{'status':'blocked_risk','checklist_result':c,'risk_result':d,'decision_record':{...b,'final_reason':'Layer\x202\x20blocked:\x20'+d['blocking_risks']['length']+'\x20CRITICAL\x20risks'}};b['layers_passed']['push']('risk');if(!a['skip_user_confirmation']){const g=generateGuardConfirmationText(a['guard_json'],c,d),h=processUserConfirmation(a['user_responses']);if(!h['approved'])return{'status':'blocked_user','checklist_result':c,'risk_result':d,'confirmation_text':g,'user_confirmation':h,'decision_record':{...b,'final_reason':'Layer\x203\x20declined:\x20'+(h['declined_reason']??'no\x20reason\x20given')}};b['layers_passed']['push']('user');if(!a['skip_environment']){const i=verifyGuardEnvironment(a['guard_json']);if(!i['testnet_tested']||!i['rely_chain_resolvable'])return{'status':'blocked_environment','checklist_result':c,'risk_result':d,'user_confirmation':h,'environment_result':i,'decision_record':{...b,'final_reason':'Layer\x204\x20failed:\x20environment\x20issues'}};b['layers_passed']['push']('environment');}return{'status':'approved','checklist_result':c,'risk_result':d,'user_confirmation':h,'confirmation_text':generateGuardConfirmationText(a['guard_json'],c,d),'decision_record':{...b,'final_decision':'approved'}};}return b['layers_passed']['push']('user'),{'status':'approved','checklist_result':c,'risk_result':d,'decision_record':{...b,'final_decision':'approved'}};}function runStaticChecklist(a,b){const c=[],d=[],e=[];for(const f of GUARD_PUBLISH_CHECKLIST){const g={...f,'status':'skip'};try{const h=evaluateChecklistItem(g['id'],a,b);g['status']=h['status'],g['detail']=h['detail'];if(h['status']==='fail')d['push'](g);else{if(h['status']==='warning')e['push'](g);}}catch(i){g['status']='warning',g['detail']='Check\x20error:\x20'+i['message'],e['push'](g);}c['push'](g);}return{'passed':d['length']===0x0,'checked_items':c,'failed_items':d,'warnings':e};}function evaluateChecklistItem(a,b,c){const d=b['root'];switch(a){case'GC-01':if(!d||!d['type'])return{'status':'fail','detail':'Root\x20node\x20missing\x20or\x20has\x20no\x20type'};return{'status':'pass'};case'GC-02':case'GC-03':case'GC-04':{if(c&&c['length']>0x0){const e=c['find'](f=>f['path']?.['includes']('table')||f['path']?.['includes']('description'));if(e)return{'status':'fail','detail':e['message']};}return{'status':'pass','detail':'Validated\x20by\x20SDK\x20validateGuardData'};}case'GC-05':{if(b['binding_scene_id']){const f=GUARD_SCENES['find'](g=>g['id']===b['binding_scene_id']);if(f)return{'status':'pass','detail':'Scene:\x20'+f['id']};return{'status':'warning','detail':'Scene\x20ID\x20\x22'+b['binding_scene_id']+'\x22\x20not\x20found\x20in\x20ledger'};}return{'status':'warning','detail':'No\x20binding\x20scene\x20identified\x20—\x20verify\x20Standalone\x20intent'};}case'GC-06':case'GC-07':case'GC-08':case'GC-09':case'GC-10':case'GC-11':if(c&&c['some'](g=>g['path']?.['includes']('query')||g['path']?.['includes']('witness')))return{'status':'fail','detail':'SDK\x20validation\x20flagged\x20query/witness\x20issues'};return{'status':'pass','detail':'Delegated\x20to\x20guard-lint.ts'};case'GC-12':return{'status':'pass','detail':'Immutability\x20noted\x20—\x20Guard\x20cannot\x20be\x20modified\x20after\x20creation'};default:return{'status':'skip'};}}function adaptRiskAssessment(a){const b=[],c=[];for(const e of a['risks']??[]){if(e['level']==='critical')b['push'](e['id']);else{if(e['level']==='high')c['push'](e['id']);}}let d='publish';if(b['length']>0x0)d='do_not_publish';else{if(c['length']>0x2)d='fix_first';}return{'overall_risk_level':a['overall_risk'],'blocking_risks':b,'warning_risks':c,'recommendation':d};}function processUserConfirmation(a){const b=GUARD_CONFIRMATION_QUESTIONS;if(!a||a['length']===0x0)return{'questions_asked':b,'user_responses':[],'approved':![],'declined_reason':'No\x20user\x20responses\x20provided','timestamp':new Date()['toISOString']()};const c=b['filter'](d=>d['blocking']);for(const d of c){const e=a['find'](f=>f['question_id']===d['id']);if(!e)return{'questions_asked':b,'user_responses':a,'approved':![],'declined_reason':'Blocking\x20question\x20'+d['id']+'\x20not\x20answered','timestamp':new Date()['toISOString']()};if(d['expected_response']==='yes'&&e['response']!=='yes')return{'questions_asked':b,'user_responses':a,'approved':![],'declined_reason':d['id']+'\x20expected\x20\x27yes\x27,\x20got\x20\x27'+e['response']+'\x27','timestamp':new Date()['toISOString']()};if(d['expected_response']==='no'&&e['response']!=='no')return{'questions_asked':b,'user_responses':a,'approved':![],'declined_reason':d['id']+'\x20expected\x20\x27no\x27,\x20got\x20\x27'+e['response']+'\x27','timestamp':new Date()['toISOString']()};}return{'questions_asked':b,'user_responses':a,'approved':!![],'timestamp':new Date()['toISOString']()};}function generateGuardConfirmationText(a,b,c){const d=[];return d['push']('═══════════════════════════════════════════════════════════'),d['push']('\x20\x20GUARD\x20PUBLISH\x20CONFIRMATION'),d['push']('═══════════════════════════════════════════════════════════'),d['push']('Name:\x20'+(a['name']??'(unnamed)')),d['push']('Description:\x20'+(a['description']??'(none)')),d['push']('Binding\x20Scene:\x20'+(a['binding_scene_id']??'Standalone')),d['push'](''),d['push']('─\x20Layer\x201:\x20Static\x20Checklist\x20─────────────────────────────'),d['push']('Result:\x20'+(b['passed']?'✅\x20PASS':'❌\x20FAIL')),d['push']('Items:\x20'+b['checked_items']['length']+'\x20checked,\x20'+b['failed_items']['length']+'\x20failed,\x20'+b['warnings']['length']+'\x20warnings'),d['push'](''),d['push']('─\x20Layer\x202:\x20Risk\x20Assessment\x20──────────────────────────────'),d['push']('Overall:\x20'+c['overall_risk_level']['toUpperCase']()),d['push']('Blocking:\x20'+c['blocking_risks']['length']+'\x20|\x20Warning:\x20'+c['warning_risks']['length']),d['push']('Recommendation:\x20'+c['recommendation']),d['push'](''),d['push']('⚠️\x20\x20CRITICAL\x20REMINDER:\x20Guard\x20is\x20IMMUTABLE\x20after\x20creation.'),d['push']('\x20\x20\x20\x20There\x20is\x20NO\x20update\x20path.\x20If\x20the\x20rule\x20is\x20wrong,\x20you\x20must'),d['push']('\x20\x20\x20\x20create\x20a\x20NEW\x20Guard\x20and\x20rebind\x20the\x20host\x20object.'),d['push'](''),d['push']('Please\x20review\x20the\x20above\x20and\x20confirm\x20publication.'),d['push']('═══════════════════════════════════════════════════════════'),d['join']('\x0a');}function verifyGuardEnvironment(a){const b=[];return!a['binding_target']&&b['push']('No\x20binding\x20target\x20specified\x20—\x20Guard\x20will\x20be\x20Standalone\x20(verify\x20intent)'),{'testnet_tested':![],'binding_target_exists':!!a['binding_target'],'rely_chain_resolvable':!![],'passport_generated_successfully':![],'warnings':b};}export function progressiveGuardCheck(a){const b=runStaticChecklist(a);if(!b['passed'])return{'layer':'checklist','result':b};const c=a['root'],d=assessGuardRisks({'table':c?.['table']??[],'root':a['root'],'rely':c?.['rely']}),e=adaptRiskAssessment(d);if(e['recommendation']==='do_not_publish')return{'layer':'risk','result':e};return{'layer':'none','result':null};}
|