@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
package/dist/harness/verify.js
CHANGED
|
@@ -1,237 +1 @@
|
|
|
1
|
-
function verifyCreated(expected, actual) {
|
|
2
|
-
const mismatches = [];
|
|
3
|
-
const expectedCreated = expected.expected.semantic_created ?? [];
|
|
4
|
-
const actualCreated = actual.semantic?.created ?? [];
|
|
5
|
-
for (const exp of expectedCreated) {
|
|
6
|
-
const found = actualCreated.find((a) => a.role === exp.role);
|
|
7
|
-
if (!found) {
|
|
8
|
-
mismatches.push({
|
|
9
|
-
dimension: "created",
|
|
10
|
-
expected: `role=${exp.role}`,
|
|
11
|
-
actual: "not found",
|
|
12
|
-
severity: "fail",
|
|
13
|
-
detail: `Expected to create object with role '${exp.role}', but none was created`,
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
for (const act of actualCreated) {
|
|
18
|
-
const expected_role = expectedCreated.find((e) => e.role === act.role);
|
|
19
|
-
if (!expected_role) {
|
|
20
|
-
mismatches.push({
|
|
21
|
-
dimension: "created",
|
|
22
|
-
expected: `no object with role=${act.role}`,
|
|
23
|
-
actual: `role=${act.role}`,
|
|
24
|
-
severity: "warn",
|
|
25
|
-
detail: `Unexpected object created with role '${act.role}' — may indicate rule table gap`,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return mismatches;
|
|
30
|
-
}
|
|
31
|
-
function verifyModified(expected, actual) {
|
|
32
|
-
const mismatches = [];
|
|
33
|
-
const expectedModified = expected.expected.semantic_modified ?? [];
|
|
34
|
-
const actualModified = actual.semantic?.modified ?? [];
|
|
35
|
-
for (const exp of expectedModified) {
|
|
36
|
-
const found = actualModified.find((a) => a.role === exp.role);
|
|
37
|
-
if (!found) {
|
|
38
|
-
mismatches.push({
|
|
39
|
-
dimension: "modified",
|
|
40
|
-
expected: `role=${exp.role} fields=${JSON.stringify(exp.expect_fields ?? {})}`,
|
|
41
|
-
actual: "not modified",
|
|
42
|
-
severity: "fail",
|
|
43
|
-
detail: `Expected to modify object with role '${exp.role}', but it was not modified`,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return mismatches;
|
|
48
|
-
}
|
|
49
|
-
function verifyReleased(expected, actual) {
|
|
50
|
-
const mismatches = [];
|
|
51
|
-
const expectedReleased = expected.expected.semantic_released ?? [];
|
|
52
|
-
const actualReleased = actual.semantic?.released ?? [];
|
|
53
|
-
for (const exp of expectedReleased) {
|
|
54
|
-
const found = actualReleased.find((a) => a.role === exp.role);
|
|
55
|
-
if (!found) {
|
|
56
|
-
mismatches.push({
|
|
57
|
-
dimension: "released",
|
|
58
|
-
expected: `role=${exp.role} amount=${exp.amount ?? "?"} from=${exp.from ?? "?"} to=${exp.to ?? "?"}`,
|
|
59
|
-
actual: "no fund movement",
|
|
60
|
-
severity: "fail",
|
|
61
|
-
detail: `Expected fund movement with role '${exp.role}', but none occurred — fund flow risk`,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
if (exp.amount && exp.amount !== found.amount) {
|
|
66
|
-
mismatches.push({
|
|
67
|
-
dimension: "released",
|
|
68
|
-
expected: `amount=${exp.amount}`,
|
|
69
|
-
actual: `amount=${found.amount}`,
|
|
70
|
-
severity: "fail",
|
|
71
|
-
detail: `Fund amount mismatch for role '${exp.role}' — fund flow risk`,
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (exp.from && found.from && exp.from !== found.from) {
|
|
75
|
-
mismatches.push({
|
|
76
|
-
dimension: "released",
|
|
77
|
-
expected: `from=${exp.from}`,
|
|
78
|
-
actual: `from=${found.from}`,
|
|
79
|
-
severity: "fail",
|
|
80
|
-
detail: `Fund source mismatch for role '${exp.role}' — fund flow direction risk`,
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
if (exp.to && found.to && exp.to !== found.to) {
|
|
84
|
-
mismatches.push({
|
|
85
|
-
dimension: "released",
|
|
86
|
-
expected: `to=${exp.to}`,
|
|
87
|
-
actual: `to=${found.to}`,
|
|
88
|
-
severity: "fail",
|
|
89
|
-
detail: `Fund destination mismatch for role '${exp.role}' — fund flow direction risk`,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return mismatches;
|
|
95
|
-
}
|
|
96
|
-
function verifyEvents(expected, actual) {
|
|
97
|
-
const mismatches = [];
|
|
98
|
-
const expectedEvents = expected.expected.events ?? [];
|
|
99
|
-
const actualEvents = actual.semantic?.events ?? [];
|
|
100
|
-
for (const exp of expectedEvents) {
|
|
101
|
-
const found = actualEvents.find((a) => a.event_type.includes(exp.type) || a.business_meaning.toLowerCase().includes(exp.type.toLowerCase()));
|
|
102
|
-
if (!found) {
|
|
103
|
-
mismatches.push({
|
|
104
|
-
dimension: "event",
|
|
105
|
-
expected: `event_type contains '${exp.type}'`,
|
|
106
|
-
actual: "event not found",
|
|
107
|
-
severity: "warn",
|
|
108
|
-
detail: `Expected event '${exp.type}' was not found — may indicate semantic layer gap or operation didn't trigger it`,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return mismatches;
|
|
113
|
-
}
|
|
114
|
-
function verifyStateTransition(expected, actual) {
|
|
115
|
-
const mismatches = [];
|
|
116
|
-
const transition = expected.expected.state_transition;
|
|
117
|
-
if (!transition)
|
|
118
|
-
return mismatches;
|
|
119
|
-
if (actual.semantic?.status === "success") {
|
|
120
|
-
return mismatches;
|
|
121
|
-
}
|
|
122
|
-
if (actual.semantic?.status === "failed") {
|
|
123
|
-
mismatches.push({
|
|
124
|
-
dimension: "state",
|
|
125
|
-
expected: `${transition.from} → ${transition.to}`,
|
|
126
|
-
actual: "operation failed",
|
|
127
|
-
severity: "fail",
|
|
128
|
-
detail: `Expected state transition '${transition.from} → ${transition.to}' failed — operation did not succeed`,
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
|
-
return mismatches;
|
|
132
|
-
}
|
|
133
|
-
export function verify(input) {
|
|
134
|
-
const mismatches = [
|
|
135
|
-
...verifyCreated(input.expected, input.actual),
|
|
136
|
-
...verifyModified(input.expected, input.actual),
|
|
137
|
-
...verifyReleased(input.expected, input.actual),
|
|
138
|
-
...verifyEvents(input.expected, input.actual),
|
|
139
|
-
...verifyStateTransition(input.expected, input.actual),
|
|
140
|
-
];
|
|
141
|
-
const hasFail = mismatches.some((m) => m.severity === "fail");
|
|
142
|
-
const hasWarn = mismatches.some((m) => m.severity === "warn");
|
|
143
|
-
const status = hasFail ? "fail" : hasWarn ? "warn" : "pass";
|
|
144
|
-
const failCount = mismatches.filter((m) => m.severity === "fail").length;
|
|
145
|
-
const warnCount = mismatches.filter((m) => m.severity === "warn").length;
|
|
146
|
-
let summary;
|
|
147
|
-
if (status === "pass") {
|
|
148
|
-
summary = "All verifications passed — expected results match actual results";
|
|
149
|
-
}
|
|
150
|
-
else if (status === "warn") {
|
|
151
|
-
summary = `${warnCount} warning(s) — operation succeeded with minor discrepancies`;
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
summary = `${failCount} failure(s), ${warnCount} warning(s) — expected results do not match actual results`;
|
|
155
|
-
}
|
|
156
|
-
return {
|
|
157
|
-
status,
|
|
158
|
-
mismatches,
|
|
159
|
-
summary,
|
|
160
|
-
timestamp: new Date().toISOString(),
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
export function generateExpected(operation, intent, operationType, data) {
|
|
164
|
-
const expected = {
|
|
165
|
-
result_type: "transaction",
|
|
166
|
-
};
|
|
167
|
-
switch (operationType) {
|
|
168
|
-
case "service":
|
|
169
|
-
if (data?.publish === true || data?.bPublished === true) {
|
|
170
|
-
expected.semantic_modified = [{ role: "Service", expect_fields: { bPublished: true } }];
|
|
171
|
-
expected.state_transition = { from: "unpublished", to: "published" };
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
expected.semantic_created = [{ role: "Service" }];
|
|
175
|
-
}
|
|
176
|
-
break;
|
|
177
|
-
case "machine":
|
|
178
|
-
expected.semantic_created = [{ role: "Machine" }];
|
|
179
|
-
break;
|
|
180
|
-
case "guard":
|
|
181
|
-
expected.semantic_created = [{ role: "Guard" }];
|
|
182
|
-
expected.events = [{ type: "GuardCreated", expect_count: ">=1" }];
|
|
183
|
-
break;
|
|
184
|
-
case "permission":
|
|
185
|
-
expected.semantic_created = [{ role: "Permission" }];
|
|
186
|
-
break;
|
|
187
|
-
case "order":
|
|
188
|
-
if (data?.arb !== undefined) {
|
|
189
|
-
expected.state_transition = { from: "ordered", to: "arbitration" };
|
|
190
|
-
}
|
|
191
|
-
else {
|
|
192
|
-
expected.semantic_created = [{ role: "Order" }];
|
|
193
|
-
expected.semantic_released = [{ role: "payment" }];
|
|
194
|
-
expected.events = [{ type: "OrderPaid", expect_count: ">=1" }];
|
|
195
|
-
}
|
|
196
|
-
break;
|
|
197
|
-
case "payment":
|
|
198
|
-
expected.semantic_released = [{ role: "payment" }];
|
|
199
|
-
break;
|
|
200
|
-
case "treasury":
|
|
201
|
-
if (data?.deposit !== undefined) {
|
|
202
|
-
expected.semantic_released = [{ role: "deposit" }];
|
|
203
|
-
}
|
|
204
|
-
else {
|
|
205
|
-
expected.semantic_released = [{ role: "release" }];
|
|
206
|
-
}
|
|
207
|
-
break;
|
|
208
|
-
case "reward":
|
|
209
|
-
if (data?.claim !== undefined || data?.withdraw !== undefined) {
|
|
210
|
-
expected.semantic_released = [{ role: "reward" }];
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
expected.semantic_created = [{ role: "Reward" }];
|
|
214
|
-
}
|
|
215
|
-
break;
|
|
216
|
-
case "allocation":
|
|
217
|
-
expected.semantic_released = [{ role: "release" }];
|
|
218
|
-
expected.events = [{ type: "Allocation", expect_count: ">=1" }];
|
|
219
|
-
break;
|
|
220
|
-
case "demand":
|
|
221
|
-
if (data?.submit !== undefined) {
|
|
222
|
-
expected.semantic_modified = [{ role: "Demand" }];
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
expected.semantic_created = [{ role: "Demand" }];
|
|
226
|
-
}
|
|
227
|
-
break;
|
|
228
|
-
default:
|
|
229
|
-
break;
|
|
230
|
-
}
|
|
231
|
-
return {
|
|
232
|
-
operation,
|
|
233
|
-
intent,
|
|
234
|
-
pre_conditions: [],
|
|
235
|
-
expected,
|
|
236
|
-
};
|
|
237
|
-
}
|
|
1
|
+
function verifyCreated(a,b){const c=[],d=a['expected']['semantic_created']??[],e=b['semantic']?.['created']??[];for(const f of d){const g=e['find'](h=>h['role']===f['role']);!g&&c['push']({'dimension':'created','expected':'role='+f['role'],'actual':'not\x20found','severity':'fail','detail':'Expected\x20to\x20create\x20object\x20with\x20role\x20\x27'+f['role']+'\x27,\x20but\x20none\x20was\x20created'});}for(const h of e){const i=d['find'](j=>j['role']===h['role']);!i&&c['push']({'dimension':'created','expected':'no\x20object\x20with\x20role='+h['role'],'actual':'role='+h['role'],'severity':'warn','detail':'Unexpected\x20object\x20created\x20with\x20role\x20\x27'+h['role']+'\x27\x20—\x20may\x20indicate\x20rule\x20table\x20gap'});}return c;}function verifyModified(a,b){const c=[],d=a['expected']['semantic_modified']??[],e=b['semantic']?.['modified']??[];for(const f of d){const g=e['find'](h=>h['role']===f['role']);!g&&c['push']({'dimension':'modified','expected':'role='+f['role']+'\x20fields='+JSON['stringify'](f['expect_fields']??{}),'actual':'not\x20modified','severity':'fail','detail':'Expected\x20to\x20modify\x20object\x20with\x20role\x20\x27'+f['role']+'\x27,\x20but\x20it\x20was\x20not\x20modified'});}return c;}function verifyReleased(a,b){const c=[],d=a['expected']['semantic_released']??[],e=b['semantic']?.['released']??[];for(const f of d){const g=e['find'](h=>h['role']===f['role']);!g?c['push']({'dimension':'released','expected':'role='+f['role']+'\x20amount='+(f['amount']??'?')+'\x20from='+(f['from']??'?')+'\x20to='+(f['to']??'?'),'actual':'no\x20fund\x20movement','severity':'fail','detail':'Expected\x20fund\x20movement\x20with\x20role\x20\x27'+f['role']+'\x27,\x20but\x20none\x20occurred\x20—\x20fund\x20flow\x20risk'}):(f['amount']&&f['amount']!==g['amount']&&c['push']({'dimension':'released','expected':'amount='+f['amount'],'actual':'amount='+g['amount'],'severity':'fail','detail':'Fund\x20amount\x20mismatch\x20for\x20role\x20\x27'+f['role']+'\x27\x20—\x20fund\x20flow\x20risk'}),f['from']&&g['from']&&f['from']!==g['from']&&c['push']({'dimension':'released','expected':'from='+f['from'],'actual':'from='+g['from'],'severity':'fail','detail':'Fund\x20source\x20mismatch\x20for\x20role\x20\x27'+f['role']+'\x27\x20—\x20fund\x20flow\x20direction\x20risk'}),f['to']&&g['to']&&f['to']!==g['to']&&c['push']({'dimension':'released','expected':'to='+f['to'],'actual':'to='+g['to'],'severity':'fail','detail':'Fund\x20destination\x20mismatch\x20for\x20role\x20\x27'+f['role']+'\x27\x20—\x20fund\x20flow\x20direction\x20risk'}));}return c;}function verifyEvents(a,b){const c=[],d=a['expected']['events']??[],e=b['semantic']?.['events']??[];for(const f of d){const g=e['find'](h=>h['event_type']['includes'](f['type'])||h['business_meaning']['toLowerCase']()['includes'](f['type']['toLowerCase']()));!g&&c['push']({'dimension':'event','expected':'event_type\x20contains\x20\x27'+f['type']+'\x27','actual':'event\x20not\x20found','severity':'warn','detail':'Expected\x20event\x20\x27'+f['type']+'\x27\x20was\x20not\x20found\x20—\x20may\x20indicate\x20semantic\x20layer\x20gap\x20or\x20operation\x20didn\x27t\x20trigger\x20it'});}return c;}function verifyStateTransition(a,b){const c=[],d=a['expected']['state_transition'];if(!d)return c;if(b['semantic']?.['status']==='success')return c;return b['semantic']?.['status']==='failed'&&c['push']({'dimension':'state','expected':d['from']+'\x20→\x20'+d['to'],'actual':'operation\x20failed','severity':'fail','detail':'Expected\x20state\x20transition\x20\x27'+d['from']+'\x20→\x20'+d['to']+'\x27\x20failed\x20—\x20operation\x20did\x20not\x20succeed'}),c;}export function verify(a){const b=[...verifyCreated(a['expected'],a['actual']),...verifyModified(a['expected'],a['actual']),...verifyReleased(a['expected'],a['actual']),...verifyEvents(a['expected'],a['actual']),...verifyStateTransition(a['expected'],a['actual'])],c=b['some'](i=>i['severity']==='fail'),d=b['some'](i=>i['severity']==='warn'),e=c?'fail':d?'warn':'pass',f=b['filter'](i=>i['severity']==='fail')['length'],g=b['filter'](i=>i['severity']==='warn')['length'];let h;if(e==='pass')h='All\x20verifications\x20passed\x20—\x20expected\x20results\x20match\x20actual\x20results';else e==='warn'?h=g+'\x20warning(s)\x20—\x20operation\x20succeeded\x20with\x20minor\x20discrepancies':h=f+'\x20failure(s),\x20'+g+'\x20warning(s)\x20—\x20expected\x20results\x20do\x20not\x20match\x20actual\x20results';return{'status':e,'mismatches':b,'summary':h,'timestamp':new Date()['toISOString']()};}export function generateExpected(a,b,c,d){const e={'result_type':'transaction'};switch(c){case'service':d?.['publish']===!![]||d?.['bPublished']===!![]?(e['semantic_modified']=[{'role':'Service','expect_fields':{'bPublished':!![]}}],e['state_transition']={'from':'unpublished','to':'published'}):e['semantic_created']=[{'role':'Service'}];break;case'machine':e['semantic_created']=[{'role':'Machine'}];break;case'guard':e['semantic_created']=[{'role':'Guard'}],e['events']=[{'type':'GuardCreated','expect_count':'>=1'}];break;case'permission':e['semantic_created']=[{'role':'Permission'}];break;case'order':d?.['arb']!==undefined?e['state_transition']={'from':'ordered','to':'arbitration'}:(e['semantic_created']=[{'role':'Order'}],e['semantic_released']=[{'role':'payment'}],e['events']=[{'type':'OrderPaid','expect_count':'>=1'}]);break;case'payment':e['semantic_released']=[{'role':'payment'}];break;case'treasury':d?.['deposit']!==undefined?e['semantic_released']=[{'role':'deposit'}]:e['semantic_released']=[{'role':'release'}];break;case'reward':d?.['claim']!==undefined||d?.['withdraw']!==undefined?e['semantic_released']=[{'role':'reward'}]:e['semantic_created']=[{'role':'Reward'}];break;case'allocation':e['semantic_released']=[{'role':'release'}],e['events']=[{'type':'Allocation','expect_count':'>=1'}];break;case'demand':d?.['submit']!==undefined?e['semantic_modified']=[{'role':'Demand'}]:e['semantic_created']=[{'role':'Demand'}];break;default:break;}return{'operation':a,'intent':b,'pre_conditions':[],'expected':e};}
|
package/dist/index.js
CHANGED
|
@@ -1,274 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
-
import { readFileSync } from "fs";
|
|
5
|
-
const packageJson = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
|
|
6
|
-
import { OnchainOperationsSchema, WipOperationsSchema, WatchQueryOperationsSchema, AccountOperationSchema, LocalMarkOperationSchema, LocalInfoOperationSchema, ProtocolInfoQuerySchema, CallOutputSchema, MessengerOperationInputSchema, MessengerOperationOutputSchema, createServerConfig, createCapabilitiesConfig, } from "./schema/index.js";
|
|
7
|
-
import { areSchemasAvailable, getSchemaIndex, } from "./schema-query/index.js";
|
|
8
|
-
import { syncDeployedToolDescriptors, shouldAutoSyncAtStartup, } from "./schema/sync-layer4.js";
|
|
9
|
-
import { isProjectServiceEnabled, observe as projectObserve, } from "./project/index.js";
|
|
10
|
-
import { registerSuccessHook } from "./schema/call/handler.js";
|
|
11
|
-
import { listServices } from "./config/index.js";
|
|
12
|
-
import { setTelemetryEnabled } from "./telemetry/index.js";
|
|
13
|
-
import { registerAllTools } from "./tools/index.js";
|
|
14
|
-
if (process.env.WOWOK_TELEMETRY === "false" || process.env.WOWOK_TELEMETRY === "0") {
|
|
15
|
-
setTelemetryEnabled(false);
|
|
16
|
-
}
|
|
17
|
-
process.on("unhandledRejection", (reason, promise) => {
|
|
18
|
-
const reasonStr = reason instanceof Error
|
|
19
|
-
? `${reason.name}: ${reason.message}\n${reason.stack ?? ""}`
|
|
20
|
-
: String(reason);
|
|
21
|
-
console.error(`[unhandledRejection] ${new Date().toISOString()}`);
|
|
22
|
-
console.error(` reason: ${reasonStr}`);
|
|
23
|
-
});
|
|
24
|
-
process.on("uncaughtException", (error) => {
|
|
25
|
-
console.error(`[uncaughtException] ${new Date().toISOString()}`);
|
|
26
|
-
console.error(` name: ${error.name}`);
|
|
27
|
-
console.error(` message: ${error.message}`);
|
|
28
|
-
console.error(` stack: ${error.stack ?? ""}`);
|
|
29
|
-
});
|
|
30
|
-
process.on("beforeExit", (code) => {
|
|
31
|
-
console.error(`[beforeExit] ${new Date().toISOString()} code=${code} — event loop empty, process would exit`);
|
|
32
|
-
console.error(` active handles: ${process._getActiveHandles?.()?.length ?? "?"}`);
|
|
33
|
-
console.error(` active requests: ${process._getActiveRequests?.()?.length ?? "?"}`);
|
|
34
|
-
});
|
|
35
|
-
process.on("exit", (code) => {
|
|
36
|
-
console.error(`[exit] ${new Date().toISOString()} code=${code} — process exiting`);
|
|
37
|
-
});
|
|
38
|
-
process.stdin.on("end", () => {
|
|
39
|
-
console.error(`[stdin end] ${new Date().toISOString()} — MCP client closed stdin`);
|
|
40
|
-
});
|
|
41
|
-
process.stdin.on("close", () => {
|
|
42
|
-
console.error(`[stdin close] ${new Date().toISOString()} — stdin stream closed`);
|
|
43
|
-
});
|
|
44
|
-
let keepaliveTimer = null;
|
|
45
|
-
function startKeepalive() {
|
|
46
|
-
if (keepaliveTimer)
|
|
47
|
-
return;
|
|
48
|
-
keepaliveTimer = setInterval(() => {
|
|
49
|
-
const mem = process.memoryUsage();
|
|
50
|
-
const heapUsedMB = Math.round(mem.heapUsed / 1024 / 1024);
|
|
51
|
-
const heapTotalMB = Math.round(mem.heapTotal / 1024 / 1024);
|
|
52
|
-
const rssMB = Math.round(mem.rss / 1024 / 1024);
|
|
53
|
-
const level = heapUsedMB > 1200 ? "WARNING" : heapUsedMB > 800 ? "INFO" : "DEBUG";
|
|
54
|
-
console.error(`[memory ${level}] heap=${heapUsedMB}MB/${heapTotalMB}MB rss=${rssMB}MB`);
|
|
55
|
-
}, 60_000);
|
|
56
|
-
}
|
|
57
|
-
startKeepalive();
|
|
58
|
-
const SERVER_DESCRIPTION = `WoWok MCP Server - Making It Easy for AI Agents to Communicate, Collaborate, Trade, and Trust.
|
|
59
|
-
|
|
60
|
-
## CRITICAL: Unified Single-Tool Architecture
|
|
61
|
-
|
|
62
|
-
This server exposes exactly ONE MCP tool: \`wowok\`. All 17 sub-tools are dispatched internally by the \`wowok\` handler.
|
|
63
|
-
|
|
64
|
-
### Call Format
|
|
65
|
-
\`\`\`
|
|
66
|
-
wowok({ tool: "<sub-tool-name>", data: {<sub-tool parameters>} })
|
|
67
|
-
\`\`\`
|
|
68
|
-
|
|
69
|
-
Accepted aliases (deprecated): \`tool_name\`/\`name\` for \`tool\`, \`args\`/\`params\` for \`data\`. Inline params (e.g. \`{ tool: "schema_query", action: "list" }\`) are also auto-wrapped into \`data\`.
|
|
70
|
-
|
|
71
|
-
### Schema-Gated Execution (Self-Correcting)
|
|
72
|
-
If your parameters don't match the sub-tool's schema, the response includes:
|
|
73
|
-
- \`result.status = "schema_mismatch"\`
|
|
74
|
-
- \`result.errors\` = specific validation errors
|
|
75
|
-
- \`schema.input\` = the correct JSON schema for the sub-tool
|
|
76
|
-
- \`schema.tool\` = which sub-tool this schema belongs to
|
|
77
|
-
|
|
78
|
-
Read the schema, fix your params, and retry. CACHE the schema in your context for future calls to the SAME sub-tool — you should only need to see each sub-tool's schema once per conversation. No separate \`schema_query\` call is needed for parameter correction.
|
|
79
|
-
|
|
80
|
-
### Unified Response Envelope
|
|
81
|
-
\`\`\`
|
|
82
|
-
{
|
|
83
|
-
"result": { "status": "success|error|schema_mismatch", "data": <sub-tool output>, "errors": [...] },
|
|
84
|
-
"schema": null | { "input": <JSON schema>, "tool": "<sub-tool-name>" }
|
|
85
|
-
}
|
|
86
|
-
\`\`\`
|
|
87
|
-
|
|
88
|
-
## CRITICAL: Schema Discovery Rule
|
|
89
|
-
|
|
90
|
-
When the current context does not contain a sub-tool's input/output schema, or when you are uncertain whether the schema you have is complete and up-to-date, you MUST query it first before calling the sub-tool. Use \`wowok({ tool: "schema_query", data: { action: "get", name: "<sub-tool>" } })` + "`" + ` for operational sub-tool schemas or \`wowok({ tool: "wowok_buildin_info", data: { info: "..." } })\` for protocol constants and reference data. Never guess schema parameters, query instruction IDs, or type codes — always retrieve them from the live server.
|
|
91
|
-
|
|
92
|
-
## CRITICAL: Global Unread Messenger Check (every conversation)
|
|
93
|
-
|
|
94
|
-
At the START of EVERY conversation — before answering the user's request, regardless of what it is about — check for unread Messenger messages and IMMEDIATELY and PROMINENTLY remind the user to read them:
|
|
95
|
-
|
|
96
|
-
\`\`\`
|
|
97
|
-
wowok({ tool: "messenger_operation", data: { operation: "watch_conversations", filter: { unreadOnly: true, previewMessageCount: 0, skipAutoMarkViewed: true } } })
|
|
98
|
-
\`\`\`
|
|
99
|
-
|
|
100
|
-
If the result contains any conversation with \`unreadCount > 0\`, surface a prominent reminder at the TOP of your response (do not wait for the user to ask), listing each peer with unread messages and the count. Use \`skipAutoMarkViewed: true\` so merely checking does not mark them read. If there are none, do not mention the check.
|
|
101
|
-
|
|
102
|
-
## Token System Overview
|
|
103
|
-
|
|
104
|
-
### Default Platform Token: WOW
|
|
105
|
-
- Token Type: 0x2::wow::WOW
|
|
106
|
-
- Precision: 1_000_000_000 (9 decimal places)
|
|
107
|
-
- This is the default token for all operations unless specified otherwise
|
|
108
|
-
|
|
109
|
-
### Multi-Token Support
|
|
110
|
-
The platform supports ANY token (e.g., USDT, USDC, custom tokens). To use non-WOW tokens:
|
|
111
|
-
1. Use query_toolkit with query_type='token_list' to query available tokens and their precision info
|
|
112
|
-
2. Use the token's full type string (e.g., '0x2::usdt::USDT') in token_type parameter
|
|
113
|
-
3. Each token has its own precision - always verify before operations
|
|
114
|
-
|
|
115
|
-
### Token Precision Handling
|
|
116
|
-
Different tokens have different precisions. ALWAYS query to verify:
|
|
117
|
-
- WOW (default): 1_000_000_000 (9 decimals)
|
|
118
|
-
- Other tokens: Use query_toolkit with query_type='token_list' to get actual precision
|
|
119
|
-
- Never assume a token's decimal places - always query first
|
|
120
|
-
|
|
121
|
-
## CRITICAL: Token Amount Handling
|
|
122
|
-
|
|
123
|
-
### Amount Input Rules
|
|
124
|
-
1. WITH currency unit (e.g., '2WOW', '10.5WOW', '100USDT'):
|
|
125
|
-
- Auto-converted using token's precision: 2WOW -> 2_000_000_000
|
|
126
|
-
- Use for: All on-chain token operations
|
|
127
|
-
- MUST match the token_type parameter
|
|
128
|
-
|
|
129
|
-
2. WITHOUT currency unit (e.g., '2', '100'):
|
|
130
|
-
- Used as-is: 2 -> 2
|
|
131
|
-
- Use for: Regular numeric parameters (counts, indices, etc.)
|
|
132
|
-
|
|
133
|
-
### Multi-Token Operation Examples
|
|
134
|
-
- Create USDT-priced Service: token_type='0x2::usdt::USDT', amount='100USDT'
|
|
135
|
-
- Allocate USDC rewards: token_type='0x2::usdc::USDC', amount='500USDC'
|
|
136
|
-
- WOW remains default: omit token_type or use '0x2::wow::WOW'
|
|
137
|
-
|
|
138
|
-
### Security Warning
|
|
139
|
-
Token amounts are HIGHLY SENSITIVE. Always:
|
|
140
|
-
- Confirm user's intent before executing transfers
|
|
141
|
-
- Verify token type and amount format (with/without unit)
|
|
142
|
-
- Query token precision if unsure
|
|
143
|
-
- Double-check large amount transactions
|
|
144
|
-
- Never assume decimal places - use explicit token unit
|
|
145
|
-
|
|
146
|
-
## Sub-tool Selection Guide
|
|
147
|
-
|
|
148
|
-
All sub-tools are called via \`wowok({ tool: "<sub-tool>", data: {...} })\`. The table below helps pick the correct \`tool\` value.
|
|
149
|
-
|
|
150
|
-
| User Intent | Correct Sub-tool | Wrong Sub-tool (Avoid) |
|
|
151
|
-
|------------|------------------|------------------------|
|
|
152
|
-
| Create service listing | onchain_operations (service) | query_toolkit |
|
|
153
|
-
| Send coins to address | onchain_operations (payment) | account_operation |
|
|
154
|
-
| Check my balance | query_toolkit (account_balance) | onchain_operations |
|
|
155
|
-
| Manage local wallet | account_operation | onchain_operations |
|
|
156
|
-
| Export Guard for edit | guard2file | query_toolkit |
|
|
157
|
-
| Send/Watch encrypted message | messenger_operation | onchain_operations |
|
|
158
|
-
| Create workflow template | onchain_operations (machine) | wip_file |
|
|
159
|
-
| Store my phone number | local_info_operation | onchain_operations |
|
|
160
|
-
| Buy service (create order) | onchain_operations (order) | onchain_operations (service) |
|
|
161
|
-
| Manage my orders | onchain_operations (order) | query_toolkit |
|
|
162
|
-
| Apply for arbitration | onchain_operations (order) | onchain_operations (arbitration) |
|
|
163
|
-
| Create reward pool for marketing | onchain_operations (reward) | onchain_operations (treasury) |
|
|
164
|
-
| Claim rewards from pool | onchain_operations (reward) | query_toolkit |
|
|
165
|
-
| Create fund allocation plan | onchain_operations (allocation) | onchain_operations (treasury) |
|
|
166
|
-
| Execute fund distribution | onchain_operations (allocation) | onchain_operations (payment) |
|
|
167
|
-
| Post service demand with reward | onchain_operations (demand) | onchain_operations (service) |
|
|
168
|
-
| Submit solution for demand | onchain_operations (demand) | onchain_operations (order) |
|
|
169
|
-
| Create team treasury | onchain_operations (treasury) | onchain_operations (allocation) |
|
|
170
|
-
| Deposit/Withdraw from treasury | onchain_operations (treasury) | onchain_operations (payment) |
|
|
171
|
-
| Create access control rules | onchain_operations (permission) | onchain_operations (guard) |
|
|
172
|
-
| Create validation rules (Guard) | onchain_operations (guard) | onchain_operations (permission) |
|
|
173
|
-
| Export Guard for editing | guard2file | query_toolkit |
|
|
174
|
-
| Export Machine nodes for editing | machineNode2file | query_toolkit |
|
|
175
|
-
| Query token list and precision | query_toolkit (token_list) | wowok_buildin_info |
|
|
176
|
-
| Watch on-chain events | onchain_events | query_toolkit |
|
|
177
|
-
| Generate WIP promise file | wip_file (generate) | messenger_operation |
|
|
178
|
-
| Sign WIP file | wip_file (sign) | account_operation (signData) |
|
|
179
|
-
| Verify WIP file integrity | wip_file (verify) | query_toolkit |
|
|
180
|
-
| Send encrypted file via messenger | messenger_operation (send_file) | wip_file |
|
|
181
|
-
| Generate Witness Timestamped Sequence (WTS) | messenger_operation (generate_wts) | wip_file |
|
|
182
|
-
| Query protocol constants | wowok_buildin_info | query_toolkit |
|
|
183
|
-
| Query sub-tool schemas | schema_query | wowok_buildin_info |
|
|
184
|
-
| Cross-chain bridge (WOW<->EVM) | bridge_operation | onchain_operations |
|
|
185
|
-
| Project deployment workflow | project_operation | onchain_operations |
|
|
186
|
-
| Runtime service toggles | config_operation | — |
|
|
187
|
-
| Service trust/risk assessment | trust_score | query_toolkit |
|
|
188
|
-
|
|
189
|
-
## Sub-tool Categories
|
|
190
|
-
|
|
191
|
-
### LOCAL ONLY (Never touch blockchain):
|
|
192
|
-
- account_operation
|
|
193
|
-
- local_mark_operation
|
|
194
|
-
- local_info_operation
|
|
195
|
-
|
|
196
|
-
### ON-CHAIN (Blockchain transactions):
|
|
197
|
-
- onchain_operations
|
|
198
|
-
- messenger_operation (some operations)
|
|
199
|
-
- wip_file (sign operation)
|
|
200
|
-
- bridge_operation
|
|
201
|
-
|
|
202
|
-
### QUERY (Read-only):
|
|
203
|
-
- query_toolkit
|
|
204
|
-
- onchain_events
|
|
205
|
-
- wowok_buildin_info
|
|
206
|
-
- schema_query
|
|
207
|
-
- guard2file
|
|
208
|
-
- machineNode2file
|
|
209
|
-
|
|
210
|
-
### WORKFLOW (Project-level):
|
|
211
|
-
- project_operation
|
|
212
|
-
- config_operation
|
|
213
|
-
- trust_score
|
|
214
|
-
`;
|
|
215
|
-
const server = new McpServer(createServerConfig(packageJson, SERVER_DESCRIPTION), createCapabilitiesConfig());
|
|
216
|
-
export { OnchainOperationsSchema, WipOperationsSchema, WatchQueryOperationsSchema, AccountOperationSchema, LocalMarkOperationSchema, LocalInfoOperationSchema, ProtocolInfoQuerySchema, CallOutputSchema, MessengerOperationInputSchema, MessengerOperationOutputSchema, };
|
|
217
|
-
async function main() {
|
|
218
|
-
if (areSchemasAvailable()) {
|
|
219
|
-
const index = getSchemaIndex();
|
|
220
|
-
if (index) {
|
|
221
|
-
console.error(`Schema system ready: ${index.tools?.length || 0} tools, ${index.operations?.length || 0} operations`);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
console.error("Schema files not available. Run 'npm run generate:schemas' to generate them.");
|
|
226
|
-
}
|
|
227
|
-
if (shouldAutoSyncAtStartup()) {
|
|
228
|
-
try {
|
|
229
|
-
const r = syncDeployedToolDescriptors({ silent: true });
|
|
230
|
-
if (r.failed > 0) {
|
|
231
|
-
console.error(`Layer 4 auto-sync: ${r.ok}/${r.total} ok, ${r.failed} failed`);
|
|
232
|
-
for (const e of r.errors) {
|
|
233
|
-
console.error(` - ${e.tool}: ${e.error}`);
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
else {
|
|
237
|
-
console.error(`Layer 4 auto-sync: ${r.ok}/${r.total} tools restored`);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
catch (e) {
|
|
241
|
-
console.error(`Layer 4 auto-sync skipped: ${e.message}`);
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
console.error("Layer 4 auto-sync disabled (WOWOK_SYNC_LAYER4=never)");
|
|
246
|
-
}
|
|
247
|
-
if (isProjectServiceEnabled()) {
|
|
248
|
-
registerSuccessHook((result, context) => {
|
|
249
|
-
if (context?.operation_type && context?.data) {
|
|
250
|
-
projectObserve(context.operation_type, context.data, result);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
console.error("ProjectService enabled — object graph observe active");
|
|
254
|
-
}
|
|
255
|
-
const activeServices = listServices().filter((s) => s.enabled).map((s) => s.name);
|
|
256
|
-
console.error(`Phase 2 active services: ${activeServices.join(", ") || "none"}`);
|
|
257
|
-
registerAllTools(server);
|
|
258
|
-
const transport = new StdioServerTransport();
|
|
259
|
-
await server.connect(transport);
|
|
260
|
-
process.on("SIGINT", async () => {
|
|
261
|
-
await server.close();
|
|
262
|
-
process.exit(0);
|
|
263
|
-
});
|
|
264
|
-
process.on("SIGTERM", async () => {
|
|
265
|
-
console.error(`[SIGTERM] ${new Date().toISOString()} — graceful shutdown`);
|
|
266
|
-
try {
|
|
267
|
-
await server.close();
|
|
268
|
-
}
|
|
269
|
-
catch {
|
|
270
|
-
}
|
|
271
|
-
process.exit(0);
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
main().catch(console.error);
|
|
2
|
+
import{McpServer}from'@modelcontextprotocol/server';import{serveStdio}from'@modelcontextprotocol/server/stdio';import{readFileSync}from'fs';const packageJson=JSON['parse'](readFileSync(new URL('../package.json',import.meta.url),'utf-8'));import{OnchainOperationsSchema,WipOperationsSchema,WatchQueryOperationsSchema,AccountOperationSchema,LocalMarkOperationSchema,LocalInfoOperationSchema,ProtocolInfoQuerySchema,CallOutputSchema,MessengerOperationInputSchema,MessengerOperationOutputSchema,createServerConfig,createCapabilitiesConfig}from'./schema/index.js';import{areSchemasAvailable,getSchemaIndex}from'./schema-query-impl/index.js';import{isProjectServiceEnabled,observe as a59a}from'./project/index.js';import{registerSuccessHook}from'./schema/call/handler.js';import{listServices}from'./config/index.js';import{setTelemetryEnabled}from'./telemetry/index.js';import{registerAllTools,SUB_TOOL_COUNT}from'./tools/index.js';import{scanDefaultIndustryPacks}from'./extensions/index.js';(process['env']['WOWOK_TELEMETRY']==='false'||process['env']['WOWOK_TELEMETRY']==='0')&&setTelemetryEnabled(![]);process['on']('unhandledRejection',(a,b)=>{const c=a instanceof Error?a['name']+':\x20'+a['message']+'\x0a'+(a['stack']??''):String(a);console['error']('[unhandledRejection]\x20'+new Date()['toISOString']()),console['error']('\x20\x20reason:\x20'+c);}),process['on']('uncaughtException',a=>{console['error']('[uncaughtException]\x20'+new Date()['toISOString']()),console['error']('\x20\x20name:\x20'+a['name']),console['error']('\x20\x20message:\x20'+a['message']),console['error']('\x20\x20stack:\x20'+(a['stack']??''));}),process['on']('beforeExit',a=>{console['error']('[beforeExit]\x20'+new Date()['toISOString']()+'\x20code='+a+'\x20—\x20event\x20loop\x20empty,\x20process\x20would\x20exit'),console['error']('\x20\x20active\x20handles:\x20'+(process['_getActiveHandles']?.()?.['length']??'?')),console['error']('\x20\x20active\x20requests:\x20'+(process['_getActiveRequests']?.()?.['length']??'?'));}),process['on']('exit',a=>{console['error']('[exit]\x20'+new Date()['toISOString']()+'\x20code='+a+'\x20—\x20process\x20exiting');}),process['stdin']['on']('end',()=>{console['error']('[stdin\x20end]\x20'+new Date()['toISOString']()+'\x20—\x20MCP\x20client\x20closed\x20stdin');}),process['stdin']['on']('close',()=>{console['error']('[stdin\x20close]\x20'+new Date()['toISOString']()+'\x20—\x20stdin\x20stream\x20closed');});let keepaliveTimer=null;function startKeepalive(){if(keepaliveTimer)return;keepaliveTimer=setInterval(()=>{const a=process['memoryUsage'](),b=Math['round'](a['heapUsed']/0x400/0x400),c=Math['round'](a['heapTotal']/0x400/0x400),d=Math['round'](a['rss']/0x400/0x400),e=b>0x4b0?'WARNING':b>0x320?'INFO':'DEBUG';console['error']('[memory\x20'+e+']\x20heap='+b+'MB/'+c+'MB\x20rss='+d+'MB');},0xea60);}startKeepalive();const SERVER_DESCRIPTION='WoWok\x20MCP\x20Server\x20-\x20Making\x20It\x20Easy\x20for\x20AI\x20Agents\x20to\x20Communicate,\x20Collaborate,\x20Trade,\x20and\x20Trust.\x0a\x0a##\x20CRITICAL:\x20Unified\x20Single-Tool\x20Architecture\x0a\x0aThis\x20server\x20exposes\x20exactly\x20ONE\x20MCP\x20tool:\x20`wowok`.\x20All\x20'+SUB_TOOL_COUNT+'\x20sub-tools\x20are\x20dispatched\x20internally\x20by\x20the\x20`wowok`\x20handler.\x0a\x0a###\x20Call\x20Format\x0a```\x0awowok({\x20tool:\x20\x22<sub-tool-name>\x22,\x20data:\x20{<sub-tool\x20parameters>}\x20})\x0a```\x0a\x0aAccepted\x20aliases\x20(deprecated):\x20`tool_name`/`name`\x20for\x20`tool`,\x20`args`/`params`\x20for\x20`data`.\x20Inline\x20params\x20(e.g.\x20`{\x20tool:\x20\x22schema_query\x22,\x20action:\x20\x22list\x22\x20}`)\x20are\x20also\x20auto-wrapped\x20into\x20`data`.\x0a\x0a###\x20Schema-Gated\x20Execution\x20(Self-Correcting)\x0aIf\x20your\x20parameters\x20don\x27t\x20match\x20the\x20sub-tool\x27s\x20schema,\x20the\x20response\x20includes:\x0a-\x20`result.status\x20=\x20\x22schema_mismatch\x22`\x0a-\x20`result.errors`\x20=\x20specific\x20validation\x20errors\x0a-\x20`schema.input`\x20=\x20the\x20correct\x20JSON\x20schema\x20for\x20the\x20sub-tool\x0a-\x20`schema.tool`\x20=\x20which\x20sub-tool\x20this\x20schema\x20belongs\x20to\x0a\x0aRead\x20the\x20schema,\x20fix\x20your\x20params,\x20and\x20retry.\x20CACHE\x20the\x20schema\x20in\x20your\x20context\x20for\x20future\x20calls\x20to\x20the\x20SAME\x20sub-tool\x20—\x20you\x20should\x20only\x20need\x20to\x20see\x20each\x20sub-tool\x27s\x20schema\x20once\x20per\x20conversation.\x20No\x20separate\x20`schema_query`\x20call\x20is\x20needed\x20for\x20parameter\x20correction.\x0a\x0a###\x20Unified\x20Response\x20Envelope\x0a```\x0a{\x0a\x20\x20\x22result\x22:\x20{\x20\x22status\x22:\x20\x22success|error|schema_mismatch\x22,\x20\x22data\x22:\x20<sub-tool\x20output>,\x20\x22errors\x22:\x20[...]\x20},\x0a\x20\x20\x22schema\x22:\x20null\x20|\x20{\x20\x22input\x22:\x20<JSON\x20schema>,\x20\x22tool\x22:\x20\x22<sub-tool-name>\x22\x20}\x0a}\x0a```\x0a\x0a##\x20CRITICAL:\x20Schema\x20Discovery\x20Rule\x0a\x0aWhen\x20the\x20current\x20context\x20does\x20not\x20contain\x20a\x20sub-tool\x27s\x20input/output\x20schema,\x20or\x20when\x20you\x20are\x20uncertain\x20whether\x20the\x20schema\x20you\x20have\x20is\x20complete\x20and\x20up-to-date,\x20you\x20MUST\x20query\x20it\x20first\x20before\x20calling\x20the\x20sub-tool.\x20Use\x20`wowok({\x20tool:\x20\x22schema_query\x22,\x20data:\x20{\x20action:\x20\x22get\x22,\x20name:\x20\x22<sub-tool>\x22\x20}\x20})'+'`'+'\x20for\x20operational\x20sub-tool\x20schemas\x20or\x20`wowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22...\x22\x20}\x20})`\x20for\x20protocol\x20constants\x20and\x20reference\x20data.\x20Never\x20guess\x20schema\x20parameters,\x20query\x20instruction\x20IDs,\x20or\x20type\x20codes\x20—\x20always\x20retrieve\x20them\x20from\x20the\x20live\x20server.\x0a\x0a##\x20CRITICAL:\x20Global\x20Unread\x20Messenger\x20Check\x20(every\x20conversation)\x0a\x0aAt\x20the\x20START\x20of\x20EVERY\x20conversation\x20—\x20before\x20answering\x20the\x20user\x27s\x20request,\x20regardless\x20of\x20what\x20it\x20is\x20about\x20—\x20check\x20for\x20unread\x20Messenger\x20messages\x20and\x20IMMEDIATELY\x20and\x20PROMINENTLY\x20remind\x20the\x20user\x20to\x20read\x20them:\x0a\x0a```\x0awowok({\x20tool:\x20\x22messenger_operation\x22,\x20data:\x20{\x20operation:\x20\x22watch_conversations\x22,\x20filter:\x20{\x20unreadOnly:\x20true,\x20previewMessageCount:\x200,\x20skipAutoMarkViewed:\x20true\x20}\x20}\x20})\x0a```\x0a\x0aIf\x20the\x20result\x20contains\x20any\x20conversation\x20with\x20`unreadCount\x20>\x200`,\x20surface\x20a\x20prominent\x20reminder\x20at\x20the\x20TOP\x20of\x20your\x20response\x20(do\x20not\x20wait\x20for\x20the\x20user\x20to\x20ask),\x20listing\x20each\x20peer\x20with\x20unread\x20messages\x20and\x20the\x20count.\x20Use\x20`skipAutoMarkViewed:\x20true`\x20so\x20merely\x20checking\x20does\x20not\x20mark\x20them\x20read.\x20If\x20there\x20are\x20none,\x20do\x20not\x20mention\x20the\x20check.\x0a\x0a##\x20CRITICAL:\x20Upgrade\x20&\x20Client\x20Install\x20Reminder\x20(every\x20conversation)\x0a\x0aAt\x20the\x20START\x20of\x20EVERY\x20conversation\x20—\x20together\x20with\x20the\x20unread\x20Messenger\x20check\x20—\x20call:\x0a\x0a```\x0awowok({\x20tool:\x20\x22wowok_buildin_info\x22,\x20data:\x20{\x20info:\x20\x22upgrade_check\x22\x20}\x20})\x0a```\x0a\x0aThen,\x20based\x20on\x20the\x20returned\x20`result.reminder`:\x0a-\x20If\x20`reminder.type\x20===\x20\x22upgrade\x22`\x20AND\x20`reminder.due\x20===\x20true`:\x20IMMEDIATELY\x20remind\x20the\x20user\x20to\x20upgrade\x20(do\x20not\x20wait\x20for\x20them\x20to\x20ask).\x20Use\x20the\x20benefit-focused\x20wording\x20below,\x20filling\x20in\x20the\x20current/latest\x20versions\x20from\x20`result.mcp`\x20/\x20`result.sdk`.\x0a-\x20If\x20`reminder.type\x20===\x20\x22install_client\x22`\x20AND\x20`reminder.due\x20===\x20true`:\x20remind\x20the\x20user\x20to\x20install\x20the\x20WoWok\x20desktop\x20client\x20(this\x20fires\x20at\x20most\x20once\x20per\x20week\x20—\x20the\x20reminder\x20state\x20is\x20persisted\x20automatically).\x0a-\x20If\x20`reminder.type\x20===\x20\x22none\x22`\x20or\x20`reminder.due\x20===\x20false`:\x20do\x20NOT\x20mention\x20upgrades\x20or\x20the\x20client.\x0a\x0aUpgrade\x20wording\x20(paraphrase\x20naturally,\x20keep\x20it\x20short\x20and\x20benefit-driven;\x20adapt\x20to\x20the\x20user\x27s\x20language):\x0a\x20\x20\x22A\x20newer\x20WoWok\x20version\x20is\x20available\x20(current\x20vX\x20→\x20latest\x20vY).\x20Upgrade\x20for\x20more\x20features\x20and\x20improvements.\x20Run:\x20npm\x20install\x20-g\x20@wowok/agent-mcp@latest\x22\x0a\x0aClient\x20install\x20wording:\x0a\x20\x20\x22The\x20WoWok\x20desktop\x20client\x20is\x20not\x20installed\x20yet.\x20It\x20provides\x20wallet\x20management,\x20encrypted\x20Messenger,\x20project\x20management\x20and\x20more.\x20Download\x20it\x20at\x20https://download.wowok.net\x20to\x20get\x20started.\x22\x0a\x0aIf\x20the\x20upgrade_check\x20itself\x20fails\x20(offline\x20/\x20registry\x20unreachable),\x20skip\x20the\x20reminder\x20—\x20never\x20fabricate\x20version\x20numbers.\x0a\x0a##\x20Token\x20System\x20Overview\x0a\x0a###\x20Default\x20Platform\x20Token:\x20WOW\x0a-\x20Token\x20Type:\x200x2::wow::WOW\x0a-\x20Precision:\x201_000_000_000\x20(9\x20decimal\x20places)\x0a-\x20This\x20is\x20the\x20default\x20token\x20for\x20all\x20operations\x20unless\x20specified\x20otherwise\x0a\x0a###\x20Multi-Token\x20Support\x0aThe\x20platform\x20supports\x20ANY\x20token\x20(e.g.,\x20USDT,\x20USDC,\x20custom\x20tokens).\x20To\x20use\x20non-WOW\x20tokens:\x0a1.\x20Use\x20query_toolkit\x20with\x20query_type=\x27token_list\x27\x20to\x20query\x20available\x20tokens\x20and\x20their\x20precision\x20info\x0a2.\x20Use\x20the\x20token\x27s\x20full\x20type\x20string\x20(e.g.,\x20\x270x2::usdt::USDT\x27)\x20in\x20token_type\x20parameter\x0a3.\x20Each\x20token\x20has\x20its\x20own\x20precision\x20-\x20always\x20verify\x20before\x20operations\x0a\x0a###\x20Token\x20Precision\x20Handling\x0aDifferent\x20tokens\x20have\x20different\x20precisions.\x20ALWAYS\x20query\x20to\x20verify:\x0a-\x20WOW\x20(default):\x201_000_000_000\x20(9\x20decimals)\x0a-\x20Other\x20tokens:\x20Use\x20query_toolkit\x20with\x20query_type=\x27token_list\x27\x20to\x20get\x20actual\x20precision\x0a-\x20Never\x20assume\x20a\x20token\x27s\x20decimal\x20places\x20-\x20always\x20query\x20first\x0a\x0a##\x20CRITICAL:\x20Token\x20Amount\x20Handling\x0a\x0a###\x20Amount\x20Input\x20Rules\x0a1.\x20WITH\x20currency\x20unit\x20(e.g.,\x20\x272WOW\x27,\x20\x2710.5WOW\x27,\x20\x27100USDT\x27):\x0a\x20\x20\x20-\x20Auto-converted\x20using\x20token\x27s\x20precision:\x202WOW\x20->\x202_000_000_000\x0a\x20\x20\x20-\x20Use\x20for:\x20All\x20on-chain\x20token\x20operations\x0a\x20\x20\x20-\x20MUST\x20match\x20the\x20token_type\x20parameter\x0a\x0a2.\x20WITHOUT\x20currency\x20unit\x20(e.g.,\x20\x272\x27,\x20\x27100\x27):\x0a\x20\x20\x20-\x20Used\x20as-is:\x202\x20->\x202\x0a\x20\x20\x20-\x20Use\x20for:\x20Regular\x20numeric\x20parameters\x20(counts,\x20indices,\x20etc.)\x0a\x0a###\x20Multi-Token\x20Operation\x20Examples\x0a-\x20Create\x20USDT-priced\x20Service:\x20token_type=\x270x2::usdt::USDT\x27,\x20amount=\x27100USDT\x27\x0a-\x20Allocate\x20USDC\x20rewards:\x20token_type=\x270x2::usdc::USDC\x27,\x20amount=\x27500USDC\x27\x0a-\x20WOW\x20remains\x20default:\x20omit\x20token_type\x20or\x20use\x20\x270x2::wow::WOW\x27\x0a\x0a###\x20Security\x20Warning\x0aToken\x20amounts\x20are\x20HIGHLY\x20SENSITIVE.\x20Always:\x0a-\x20Confirm\x20user\x27s\x20intent\x20before\x20executing\x20transfers\x0a-\x20Verify\x20token\x20type\x20and\x20amount\x20format\x20(with/without\x20unit)\x0a-\x20Query\x20token\x20precision\x20if\x20unsure\x0a-\x20Double-check\x20large\x20amount\x20transactions\x0a-\x20Never\x20assume\x20decimal\x20places\x20-\x20use\x20explicit\x20token\x20unit\x0a\x0a##\x20Sub-tool\x20Selection\x20Guide\x0a\x0aAll\x20sub-tools\x20are\x20called\x20via\x20`wowok({\x20tool:\x20\x22<sub-tool>\x22,\x20data:\x20{...}\x20})`.\x20The\x20table\x20below\x20helps\x20pick\x20the\x20correct\x20`tool`\x20value.\x0a\x0a|\x20User\x20Intent\x20|\x20Correct\x20Sub-tool\x20|\x20Wrong\x20Sub-tool\x20(Avoid)\x20|\x0a|------------|------------------|------------------------|\x0a|\x20Create\x20service\x20listing\x20|\x20onchain_operations\x20(service)\x20|\x20query_toolkit\x20|\x0a|\x20Send\x20coins\x20to\x20address\x20|\x20onchain_operations\x20(payment)\x20|\x20account_operation\x20|\x0a|\x20Check\x20my\x20balance\x20|\x20query_toolkit\x20(account_balance)\x20|\x20onchain_operations\x20|\x0a|\x20Manage\x20local\x20wallet\x20|\x20account_operation\x20|\x20onchain_operations\x20|\x0a|\x20Export\x20Guard\x20for\x20edit\x20|\x20guard2file\x20|\x20query_toolkit\x20|\x0a|\x20Send/Watch\x20encrypted\x20message\x20|\x20messenger_operation\x20|\x20onchain_operations\x20|\x0a|\x20Create\x20workflow\x20template\x20|\x20onchain_operations\x20(machine)\x20|\x20wip_file\x20|\x0a|\x20Store\x20my\x20phone\x20number\x20|\x20local_info_operation\x20|\x20onchain_operations\x20|\x0a|\x20Buy\x20service\x20(create\x20order)\x20|\x20onchain_operations\x20(order)\x20|\x20onchain_operations\x20(service)\x20|\x0a|\x20Manage\x20my\x20orders\x20|\x20onchain_operations\x20(order)\x20|\x20query_toolkit\x20|\x0a|\x20Apply\x20for\x20arbitration\x20|\x20onchain_operations\x20(order)\x20|\x20onchain_operations\x20(arbitration)\x20|\x0a|\x20Create\x20reward\x20pool\x20for\x20marketing\x20|\x20onchain_operations\x20(reward)\x20|\x20onchain_operations\x20(treasury)\x20|\x0a|\x20Claim\x20rewards\x20from\x20pool\x20|\x20onchain_operations\x20(reward)\x20|\x20query_toolkit\x20|\x0a|\x20Create\x20fund\x20allocation\x20plan\x20|\x20onchain_operations\x20(allocation)\x20|\x20onchain_operations\x20(treasury)\x20|\x0a|\x20Execute\x20fund\x20distribution\x20|\x20onchain_operations\x20(allocation)\x20|\x20onchain_operations\x20(payment)\x20|\x0a|\x20Post\x20service\x20demand\x20with\x20reward\x20|\x20onchain_operations\x20(demand)\x20|\x20onchain_operations\x20(service)\x20|\x0a|\x20Submit\x20solution\x20for\x20demand\x20|\x20onchain_operations\x20(demand)\x20|\x20onchain_operations\x20(order)\x20|\x0a|\x20Create\x20team\x20treasury\x20|\x20onchain_operations\x20(treasury)\x20|\x20onchain_operations\x20(allocation)\x20|\x0a|\x20Deposit/Withdraw\x20from\x20treasury\x20|\x20onchain_operations\x20(treasury)\x20|\x20onchain_operations\x20(payment)\x20|\x0a|\x20Create\x20access\x20control\x20rules\x20|\x20onchain_operations\x20(permission)\x20|\x20onchain_operations\x20(guard)\x20|\x0a|\x20Create\x20validation\x20rules\x20(Guard)\x20|\x20onchain_operations\x20(guard)\x20|\x20onchain_operations\x20(permission)\x20|\x0a|\x20Export\x20Guard\x20for\x20editing\x20|\x20guard2file\x20|\x20query_toolkit\x20|\x0a|\x20Export\x20Machine\x20nodes\x20for\x20editing\x20|\x20machineNode2file\x20|\x20query_toolkit\x20|\x0a|\x20Query\x20token\x20list\x20and\x20precision\x20|\x20query_toolkit\x20(token_list)\x20|\x20wowok_buildin_info\x20|\x0a|\x20Watch\x20on-chain\x20events\x20|\x20onchain_events\x20|\x20query_toolkit\x20|\x0a|\x20Generate\x20WIP\x20promise\x20file\x20|\x20wip_file\x20(generate)\x20|\x20messenger_operation\x20|\x0a|\x20Sign\x20WIP\x20file\x20|\x20wip_file\x20(sign)\x20|\x20account_operation\x20(signData)\x20|\x0a|\x20Verify\x20WIP\x20file\x20integrity\x20|\x20wip_file\x20(verify)\x20|\x20query_toolkit\x20|\x0a|\x20Send\x20encrypted\x20file\x20via\x20messenger\x20|\x20messenger_operation\x20(send_file)\x20|\x20wip_file\x20|\x0a|\x20Generate\x20Witness\x20Timestamped\x20Sequence\x20(WTS)\x20|\x20messenger_operation\x20(generate_wts)\x20|\x20wip_file\x20|\x0a|\x20Query\x20protocol\x20constants\x20|\x20wowok_buildin_info\x20|\x20query_toolkit\x20|\x0a|\x20Query\x20sub-tool\x20schemas\x20|\x20schema_query\x20|\x20wowok_buildin_info\x20|\x0a|\x20Cross-chain\x20bridge\x20(WOW<->EVM)\x20|\x20bridge_operation\x20|\x20onchain_operations\x20|\x0a|\x20Project\x20deployment\x20workflow\x20|\x20project_operation\x20|\x20onchain_operations\x20|\x0a|\x20Runtime\x20service\x20toggles\x20|\x20config_operation\x20|\x20—\x20|\x0a|\x20Service\x20trust/risk\x20assessment\x20|\x20trust_score\x20|\x20query_toolkit\x20|\x0a|\x20Query\x20dynamic\x20table\x20data\x20/\x20table\x20items\x20|\x20onchain_table_data\x20|\x20query_toolkit\x20|\x0a|\x20Check\x20async\x20task\x20status\x20|\x20query_task_status\x20|\x20config_operation\x20|\x0a|\x20Business\x20evaluation\x20(risk/match/game/evidence)\x20|\x20evaluation_operation\x20|\x20trust_score\x20|\x0a|\x20Set\x20user\x20persona\x20/\x20preferences\x20|\x20persona_operation\x20|\x20local_info_operation\x20|\x0a|\x20Match\x20business\x20intent\x20to\x20chain\x20events\x20|\x20intent_radar\x20|\x20onchain_events\x20|\x0a|\x20Manage\x20employee\x20KPI\x20/\x20liability\x20|\x20employee_operation\x20|\x20onchain_operations\x20|\x0a|\x20Scaffold\x20/\x20register\x20industry\x20pack\x20|\x20industry_pack_operation\x20|\x20persona_operation\x20|\x0a|\x20Read\x20/\x20write\x20local\x20workspace\x20files\x20|\x20workspace_operation\x20|\x20local_info_operation\x20|\x0a\x0a##\x20Sub-tool\x20Categories\x0a\x0a###\x20LOCAL\x20ONLY\x20(Never\x20touch\x20blockchain):\x0a-\x20account_operation\x0a-\x20local_mark_operation\x0a-\x20local_info_operation\x0a-\x20persona_operation\x0a-\x20employee_operation\x0a-\x20industry_pack_operation\x0a-\x20workspace_operation\x0a\x0a###\x20ON-CHAIN\x20(Blockchain\x20transactions):\x0a-\x20onchain_operations\x0a-\x20messenger_operation\x20(some\x20operations)\x0a-\x20wip_file\x20(sign\x20operation)\x0a-\x20bridge_operation\x0a\x0a###\x20QUERY\x20(Read-only):\x0a-\x20query_toolkit\x0a-\x20onchain_events\x0a-\x20onchain_table_data\x0a-\x20wowok_buildin_info\x0a-\x20schema_query\x0a-\x20guard2file\x0a-\x20machineNode2file\x0a-\x20query_task_status\x0a-\x20evaluation_operation\x0a-\x20intent_radar\x0a\x0a###\x20WORKFLOW\x20(Project-level):\x0a-\x20project_operation\x0a-\x20config_operation\x0a-\x20trust_score\x0a';function buildServer(){const a=new McpServer(createServerConfig(packageJson,SERVER_DESCRIPTION),createCapabilitiesConfig());return registerAllTools(a),a;}export{OnchainOperationsSchema,WipOperationsSchema,WatchQueryOperationsSchema,AccountOperationSchema,LocalMarkOperationSchema,LocalInfoOperationSchema,ProtocolInfoQuerySchema,CallOutputSchema,MessengerOperationInputSchema,MessengerOperationOutputSchema};async function main(){if(areSchemasAvailable()){const c=getSchemaIndex();c&&console['error']('Schema\x20system\x20ready:\x20'+(c['tools']?.['length']||0x0)+'\x20tools,\x20'+(c['operations']?.['length']||0x0)+'\x20operations');}else console['error']('Schema\x20files\x20not\x20available.\x20Run\x20\x27npm\x20run\x20generate:schemas\x27\x20to\x20generate\x20them.');isProjectServiceEnabled()&&(registerSuccessHook((d,f)=>{f?.['operation_type']&&f?.['data']&&a59a(f['operation_type'],f['data'],d);}),console['error']('ProjectService\x20enabled\x20—\x20object\x20graph\x20observe\x20active'));const a=listServices()['filter'](d=>d['enabled'])['map'](d=>d['name']);console['error']('Phase\x202\x20active\x20services:\x20'+(a['join'](',\x20')||'none'));try{const d=scanDefaultIndustryPacks(),f=d['filter'](g=>g['ok'])['length'];console['error']('Industry\x20packs\x20ready:\x20'+f+'/'+d['length']+'\x20registered\x20at\x20startup');}catch(g){console['error']('[industry]\x20startup\x20bootstrap\x20failed:\x20'+g['message']);}const b=serveStdio(()=>buildServer());process['on']('SIGINT',async()=>{await b['close'](),process['exit'](0x0);}),process['on']('SIGTERM',async()=>{console['error']('[SIGTERM]\x20'+new Date()['toISOString']()+'\x20—\x20graceful\x20shutdown');try{await b['close']();}catch{}process['exit'](0x0);});}main()['catch'](console['error']);
|
package/dist/intent/enrich.js
CHANGED
|
@@ -1,67 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
const OBJECT_FIELDS = [
|
|
3
|
-
"service",
|
|
4
|
-
"demand",
|
|
5
|
-
"order",
|
|
6
|
-
"progress",
|
|
7
|
-
"arb",
|
|
8
|
-
"arbitration",
|
|
9
|
-
"machine",
|
|
10
|
-
"allocation",
|
|
11
|
-
];
|
|
12
|
-
const TEXT_FIELDS = ["recommend", "feedback", "node", "description"];
|
|
13
|
-
const MAX_OBJECTS_PER_QUERY = 50;
|
|
14
|
-
function hasText(event) {
|
|
15
|
-
return TEXT_FIELDS.some((k) => {
|
|
16
|
-
const v = event[k];
|
|
17
|
-
return typeof v === "string" && v.length > 0;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
export async function enrichEventsWithObjectText(events, network) {
|
|
21
|
-
const ids = new Set();
|
|
22
|
-
for (const ev of events) {
|
|
23
|
-
if (hasText(ev))
|
|
24
|
-
continue;
|
|
25
|
-
for (const k of OBJECT_FIELDS) {
|
|
26
|
-
const v = ev[k];
|
|
27
|
-
if (typeof v === "string" && v.startsWith("0x"))
|
|
28
|
-
ids.add(v);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (ids.size === 0)
|
|
32
|
-
return events;
|
|
33
|
-
const descById = new Map();
|
|
34
|
-
const idList = Array.from(ids);
|
|
35
|
-
for (let i = 0; i < idList.length; i += MAX_OBJECTS_PER_QUERY) {
|
|
36
|
-
const batch = idList.slice(i, i + MAX_OBJECTS_PER_QUERY);
|
|
37
|
-
try {
|
|
38
|
-
const res = await query_objects({ objects: batch, no_cache: false, network });
|
|
39
|
-
const objects = res?.objects ?? [];
|
|
40
|
-
for (const obj of objects) {
|
|
41
|
-
const id = obj?.object;
|
|
42
|
-
const desc = obj?.description;
|
|
43
|
-
if (typeof id === "string" && typeof desc === "string" && desc) {
|
|
44
|
-
descById.set(id, desc);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
if (descById.size === 0)
|
|
52
|
-
return events;
|
|
53
|
-
return events.map((ev) => {
|
|
54
|
-
if (hasText(ev))
|
|
55
|
-
return ev;
|
|
56
|
-
for (const k of OBJECT_FIELDS) {
|
|
57
|
-
const v = ev[k];
|
|
58
|
-
if (typeof v === "string") {
|
|
59
|
-
const desc = descById.get(v);
|
|
60
|
-
if (desc) {
|
|
61
|
-
return { ...ev, _enriched_description: desc, description: desc };
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return ev;
|
|
66
|
-
});
|
|
67
|
-
}
|
|
1
|
+
import{query_objects}from'@wowok/wowok';const OBJECT_FIELDS=['service','demand','order','progress','arb','arbitration','machine','allocation'],TEXT_FIELDS=['recommend','feedback','node','description'],MAX_OBJECTS_PER_QUERY=0x32;function hasText(a){return TEXT_FIELDS['some'](b=>{const c=a[b];return typeof c==='string'&&c['length']>0x0;});}export async function enrichEventsWithObjectText(a,b){const c=new Set();for(const f of a){if(hasText(f))continue;for(const g of OBJECT_FIELDS){const h=f[g];if(typeof h==='string'&&h['startsWith']('0x'))c['add'](h);}}if(c['size']===0x0)return a;const d=new Map(),e=Array['from'](c);for(let j=0x0;j<e['length'];j+=MAX_OBJECTS_PER_QUERY){const l=e['slice'](j,j+MAX_OBJECTS_PER_QUERY);try{const m=await query_objects({'objects':l,'no_cache':![],'network':b}),n=m?.['objects']??[];for(const o of n){const p=o?.['object'],q=o?.['description'];typeof p==='string'&&typeof q==='string'&&q&&d['set'](p,q);}}catch{}}if(d['size']===0x0)return a;return a['map'](r=>{if(hasText(r))return r;for(const s of OBJECT_FIELDS){const t=r[s];if(typeof t==='string'){const u=d['get'](t);if(u)return{...r,'_enriched_description':u,'description':u};}}return r;});}
|