trustbase-seller-backend 0.1.5
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/.agents/skills/wechatpay-payment-integration/SKILL.md +165 -0
- package/.agents/skills/wechatpay-payment-integration/references/APIv3/346/216/245/345/217/243/345/212/250/346/200/201/346/216/222/351/232/234.md +234 -0
- package/.agents/skills/wechatpay-payment-integration/references/wechatpay-dev-cli/344/275/277/347/224/250/350/257/264/346/230/216.md +74 -0
- package/.agents/skills/wechatpay-payment-integration/references//345/237/272/347/241/200/346/246/202/345/277/265/345/217/212/344/270/232/345/212/241/344/273/213/347/273/215.md +109 -0
- package/.agents/skills/wechatpay-payment-integration/references//345/246/202/344/275/225/347/220/206/350/247/243/347/224/250/346/210/267/351/227/256/351/242/230.md +55 -0
- package/.agents/skills/wechatpay-payment-integration/references//346/216/245/345/205/245/350/264/250/351/207/217/346/243/200/346/237/245/346/270/205/345/215/225.md +70 -0
- package/.agents/skills/wechatpay-payment-integration/references//346/226/207/346/241/243/346/243/200/347/264/242/344/270/216/351/227/256/347/255/224.md +99 -0
- package/.agents/skills/wechatpay-payment-integration/scripts/bash/extract_and_sign.sh +231 -0
- package/.agents/skills/wechatpay-payment-integration/scripts/powershell/extract_and_sign.ps1 +199 -0
- package/.agents/skills/wechatpay-payment-integration/scripts/wechatpay-resource-sync.py +646 -0
- package/.env.example +70 -0
- package/MERCHANT-EDITION.md +56 -0
- package/README.md +99 -0
- package/api/__tests__/test-utils.d.ts +33 -0
- package/api/__tests__/test-utils.d.ts.map +1 -0
- package/api/__tests__/test-utils.js +90 -0
- package/api/__tests__/test-utils.js.map +1 -0
- package/api/db/case-library-types.d.ts +47 -0
- package/api/db/case-library-types.d.ts.map +1 -0
- package/api/db/case-library-types.js +105 -0
- package/api/db/case-library-types.js.map +1 -0
- package/api/db/case-library.db.d.ts +5 -0
- package/api/db/case-library.db.d.ts.map +1 -0
- package/api/db/case-library.db.js +127 -0
- package/api/db/case-library.db.js.map +1 -0
- package/api/email.d.ts +56 -0
- package/api/email.d.ts.map +1 -0
- package/api/email.js +307 -0
- package/api/email.js.map +1 -0
- package/api/index.d.ts +22 -0
- package/api/index.d.ts.map +1 -0
- package/api/index.js +41 -0
- package/api/index.js.map +1 -0
- package/api/integration-helpers.d.ts +153 -0
- package/api/integration-helpers.d.ts.map +1 -0
- package/api/integration-helpers.js +361 -0
- package/api/integration-helpers.js.map +1 -0
- package/api/lib/case-summary.d.ts +10 -0
- package/api/lib/case-summary.d.ts.map +1 -0
- package/api/lib/case-summary.js +30 -0
- package/api/lib/case-summary.js.map +1 -0
- package/api/middleware/p2p-auth.d.ts +140 -0
- package/api/middleware/p2p-auth.d.ts.map +1 -0
- package/api/middleware/p2p-auth.js +510 -0
- package/api/middleware/p2p-auth.js.map +1 -0
- package/api/middleware/tool-policy.d.ts +47 -0
- package/api/middleware/tool-policy.d.ts.map +1 -0
- package/api/middleware/tool-policy.js +156 -0
- package/api/middleware/tool-policy.js.map +1 -0
- package/api/oauth-adapters.d.ts +192 -0
- package/api/oauth-adapters.d.ts.map +1 -0
- package/api/oauth-adapters.js +456 -0
- package/api/oauth-adapters.js.map +1 -0
- package/api/oauth-bridge.d.ts +56 -0
- package/api/oauth-bridge.d.ts.map +1 -0
- package/api/oauth-bridge.js +624 -0
- package/api/oauth-bridge.js.map +1 -0
- package/api/oauth-router.d.ts +36 -0
- package/api/oauth-router.d.ts.map +1 -0
- package/api/oauth-router.js +54 -0
- package/api/oauth-router.js.map +1 -0
- package/api/p2p-mcp.d.ts +69 -0
- package/api/p2p-mcp.d.ts.map +1 -0
- package/api/p2p-mcp.js +286 -0
- package/api/p2p-mcp.js.map +1 -0
- package/api/payment-store.d.ts +56 -0
- package/api/payment-store.d.ts.map +1 -0
- package/api/payment-store.js +163 -0
- package/api/payment-store.js.map +1 -0
- package/api/payment.d.ts +14 -0
- package/api/payment.d.ts.map +1 -0
- package/api/payment.js +216 -0
- package/api/payment.js.map +1 -0
- package/api/pwa-stats.d.ts +67 -0
- package/api/pwa-stats.d.ts.map +1 -0
- package/api/pwa-stats.js +269 -0
- package/api/pwa-stats.js.map +1 -0
- package/api/riskcontrol-adapters.d.ts +114 -0
- package/api/riskcontrol-adapters.d.ts.map +1 -0
- package/api/riskcontrol-adapters.js +210 -0
- package/api/riskcontrol-adapters.js.map +1 -0
- package/api/riskcontrol-event-whitelist.d.ts +81 -0
- package/api/riskcontrol-event-whitelist.d.ts.map +1 -0
- package/api/riskcontrol-event-whitelist.js +181 -0
- package/api/riskcontrol-event-whitelist.js.map +1 -0
- package/api/riskcontrol-rules.d.ts +105 -0
- package/api/riskcontrol-rules.d.ts.map +1 -0
- package/api/riskcontrol-rules.js +399 -0
- package/api/riskcontrol-rules.js.map +1 -0
- package/api/riskcontrol-scoring.d.ts +72 -0
- package/api/riskcontrol-scoring.d.ts.map +1 -0
- package/api/riskcontrol-scoring.js +335 -0
- package/api/riskcontrol-scoring.js.map +1 -0
- package/api/riskcontrol-service.d.ts +60 -0
- package/api/riskcontrol-service.d.ts.map +1 -0
- package/api/riskcontrol-service.js +206 -0
- package/api/riskcontrol-service.js.map +1 -0
- package/api/riskcontrol-stream.d.ts +112 -0
- package/api/riskcontrol-stream.d.ts.map +1 -0
- package/api/riskcontrol-stream.js +230 -0
- package/api/riskcontrol-stream.js.map +1 -0
- package/api/riskcontrol-v5-e2e-test.d.ts +15 -0
- package/api/riskcontrol-v5-e2e-test.d.ts.map +1 -0
- package/api/riskcontrol-v5-e2e-test.js +204 -0
- package/api/riskcontrol-v5-e2e-test.js.map +1 -0
- package/api/riskcontrol-v5-router.d.ts +48 -0
- package/api/riskcontrol-v5-router.d.ts.map +1 -0
- package/api/riskcontrol-v5-router.js +226 -0
- package/api/riskcontrol-v5-router.js.map +1 -0
- package/api/riskcontrol-webhook.d.ts +88 -0
- package/api/riskcontrol-webhook.d.ts.map +1 -0
- package/api/riskcontrol-webhook.js +326 -0
- package/api/riskcontrol-webhook.js.map +1 -0
- package/api/routes/case-library.d.ts +4 -0
- package/api/routes/case-library.d.ts.map +1 -0
- package/api/routes/case-library.js +91 -0
- package/api/routes/case-library.js.map +1 -0
- package/api/seller-earnings.d.ts +23 -0
- package/api/seller-earnings.d.ts.map +1 -0
- package/api/seller-earnings.js +258 -0
- package/api/seller-earnings.js.map +1 -0
- package/api/seller-orders.d.ts +25 -0
- package/api/seller-orders.d.ts.map +1 -0
- package/api/seller-orders.js +398 -0
- package/api/seller-orders.js.map +1 -0
- package/api/seller-products-chain.d.ts +31 -0
- package/api/seller-products-chain.d.ts.map +1 -0
- package/api/seller-products-chain.js +308 -0
- package/api/seller-products-chain.js.map +1 -0
- package/api/seller-products.d.ts +30 -0
- package/api/seller-products.d.ts.map +1 -0
- package/api/seller-products.js +453 -0
- package/api/seller-products.js.map +1 -0
- package/api/seller-reputation.d.ts +21 -0
- package/api/seller-reputation.d.ts.map +1 -0
- package/api/seller-reputation.js +204 -0
- package/api/seller-reputation.js.map +1 -0
- package/api/seller-router.d.ts +33 -0
- package/api/seller-router.d.ts.map +1 -0
- package/api/seller-router.js +53 -0
- package/api/seller-router.js.map +1 -0
- package/api/seller-settings.d.ts +23 -0
- package/api/seller-settings.d.ts.map +1 -0
- package/api/seller-settings.js +279 -0
- package/api/seller-settings.js.map +1 -0
- package/api/shipping-store.d.ts +44 -0
- package/api/shipping-store.d.ts.map +1 -0
- package/api/shipping-store.js +154 -0
- package/api/shipping-store.js.map +1 -0
- package/api/shipping.d.ts +16 -0
- package/api/shipping.d.ts.map +1 -0
- package/api/shipping.js +239 -0
- package/api/shipping.js.map +1 -0
- package/api/social-endpoint-verify.d.ts +8 -0
- package/api/social-endpoint-verify.d.ts.map +1 -0
- package/api/social-endpoint-verify.js +152 -0
- package/api/social-endpoint-verify.js.map +1 -0
- package/api/social-posts.d.ts +65 -0
- package/api/social-posts.d.ts.map +1 -0
- package/api/social-posts.js +534 -0
- package/api/social-posts.js.map +1 -0
- package/api/social-router.d.ts +36 -0
- package/api/social-router.d.ts.map +1 -0
- package/api/social-router.js +56 -0
- package/api/social-router.js.map +1 -0
- package/api/social-shares.d.ts +40 -0
- package/api/social-shares.d.ts.map +1 -0
- package/api/social-shares.js +379 -0
- package/api/social-shares.js.map +1 -0
- package/api/social-whitelist.d.ts +41 -0
- package/api/social-whitelist.d.ts.map +1 -0
- package/api/social-whitelist.js +261 -0
- package/api/social-whitelist.js.map +1 -0
- package/api/storefront-orders.d.ts +23 -0
- package/api/storefront-orders.d.ts.map +1 -0
- package/api/storefront-orders.js +349 -0
- package/api/storefront-orders.js.map +1 -0
- package/api/storefront-products.d.ts +21 -0
- package/api/storefront-products.d.ts.map +1 -0
- package/api/storefront-products.js +181 -0
- package/api/storefront-products.js.map +1 -0
- package/api/storefront-router.d.ts +33 -0
- package/api/storefront-router.d.ts.map +1 -0
- package/api/storefront-router.js +47 -0
- package/api/storefront-router.js.map +1 -0
- package/api/storefront-user.d.ts +23 -0
- package/api/storefront-user.d.ts.map +1 -0
- package/api/storefront-user.js +336 -0
- package/api/storefront-user.js.map +1 -0
- package/api/test-db-helper.d.ts +29 -0
- package/api/test-db-helper.d.ts.map +1 -0
- package/api/test-db-helper.js +107 -0
- package/api/test-db-helper.js.map +1 -0
- package/api/traffic.d.ts +22 -0
- package/api/traffic.d.ts.map +1 -0
- package/api/traffic.js +112 -0
- package/api/traffic.js.map +1 -0
- package/api/wc-credentials.d.ts +34 -0
- package/api/wc-credentials.d.ts.map +1 -0
- package/api/wc-credentials.js +296 -0
- package/api/wc-credentials.js.map +1 -0
- package/api/wc-tracker-receiver.d.ts +47 -0
- package/api/wc-tracker-receiver.d.ts.map +1 -0
- package/api/wc-tracker-receiver.js +264 -0
- package/api/wc-tracker-receiver.js.map +1 -0
- package/api/wc-v3.d.ts +40 -0
- package/api/wc-v3.d.ts.map +1 -0
- package/api/wc-v3.js +694 -0
- package/api/wc-v3.js.map +1 -0
- package/bin/tb-doctor.js +32 -0
- package/bin/tb-seller-backend.js +42 -0
- package/check.d.ts +2 -0
- package/check.d.ts.map +1 -0
- package/check.js +19 -0
- package/check.js.map +1 -0
- package/config/export-import.d.ts +108 -0
- package/config/export-import.d.ts.map +1 -0
- package/config/export-import.js +234 -0
- package/config/export-import.js.map +1 -0
- package/config/manager.d.ts +73 -0
- package/config/manager.d.ts.map +1 -0
- package/config/manager.js +246 -0
- package/config/manager.js.map +1 -0
- package/config/profile.d.ts +42 -0
- package/config/profile.d.ts.map +1 -0
- package/config/profile.js +111 -0
- package/config/profile.js.map +1 -0
- package/core/address.js +23 -0
- package/core/advanced-performance.d.ts +149 -0
- package/core/advanced-performance.d.ts.map +1 -0
- package/core/advanced-performance.js +374 -0
- package/core/advanced-performance.js.map +1 -0
- package/core/alerting.d.ts +91 -0
- package/core/alerting.d.ts.map +1 -0
- package/core/alerting.js +379 -0
- package/core/alerting.js.map +1 -0
- package/core/app-store.d.ts +77 -0
- package/core/app-store.d.ts.map +1 -0
- package/core/app-store.js +207 -0
- package/core/app-store.js.map +1 -0
- package/core/boot-env.js +39 -0
- package/core/business-scope-schema.d.ts +60 -0
- package/core/business-scope-schema.d.ts.map +1 -0
- package/core/business-scope-schema.js +165 -0
- package/core/business-scope-schema.js.map +1 -0
- package/core/cache.d.ts +53 -0
- package/core/cache.d.ts.map +1 -0
- package/core/cache.js +130 -0
- package/core/cache.js.map +1 -0
- package/core/chain-listener.d.ts +47 -0
- package/core/chain-listener.d.ts.map +1 -0
- package/core/chain-listener.js +254 -0
- package/core/chain-listener.js.map +1 -0
- package/core/chain-reject.js +107 -0
- package/core/chain-signer.js +258 -0
- package/core/cleanup.d.ts +42 -0
- package/core/cleanup.d.ts.map +1 -0
- package/core/cleanup.js +144 -0
- package/core/cleanup.js.map +1 -0
- package/core/cluster.d.ts +78 -0
- package/core/cluster.d.ts.map +1 -0
- package/core/cluster.js +215 -0
- package/core/cluster.js.map +1 -0
- package/core/community-review.d.ts +82 -0
- package/core/community-review.d.ts.map +1 -0
- package/core/community-review.js +201 -0
- package/core/community-review.js.map +1 -0
- package/core/connection-pool.d.ts +72 -0
- package/core/connection-pool.d.ts.map +1 -0
- package/core/connection-pool.js +173 -0
- package/core/connection-pool.js.map +1 -0
- package/core/consistency.d.ts +130 -0
- package/core/consistency.d.ts.map +1 -0
- package/core/consistency.js +340 -0
- package/core/consistency.js.map +1 -0
- package/core/content-ai.d.ts +303 -0
- package/core/content-ai.d.ts.map +1 -0
- package/core/content-ai.js +344 -0
- package/core/content-ai.js.map +1 -0
- package/core/content-backfill.d.ts +55 -0
- package/core/content-backfill.d.ts.map +1 -0
- package/core/content-backfill.js +174 -0
- package/core/content-backfill.js.map +1 -0
- package/core/conversion-rate-sync.d.ts +97 -0
- package/core/conversion-rate-sync.d.ts.map +1 -0
- package/core/conversion-rate-sync.js +195 -0
- package/core/conversion-rate-sync.js.map +1 -0
- package/core/coverage-backup.d.ts +87 -0
- package/core/coverage-backup.d.ts.map +1 -0
- package/core/coverage-backup.js +265 -0
- package/core/coverage-backup.js.map +1 -0
- package/core/db-installer.d.ts +108 -0
- package/core/db-installer.d.ts.map +1 -0
- package/core/db-installer.js +414 -0
- package/core/db-installer.js.map +1 -0
- package/core/device-analyzer.d.ts +96 -0
- package/core/device-analyzer.d.ts.map +1 -0
- package/core/device-analyzer.js +235 -0
- package/core/device-analyzer.js.map +1 -0
- package/core/discovery.d.ts +165 -0
- package/core/discovery.d.ts.map +1 -0
- package/core/discovery.js +363 -0
- package/core/discovery.js.map +1 -0
- package/core/distributed.d.ts +172 -0
- package/core/distributed.d.ts.map +1 -0
- package/core/distributed.js +422 -0
- package/core/distributed.js.map +1 -0
- package/core/doctor.js +249 -0
- package/core/enforcement.d.ts +57 -0
- package/core/enforcement.d.ts.map +1 -0
- package/core/enforcement.js +115 -0
- package/core/enforcement.js.map +1 -0
- package/core/error-handler.d.ts +131 -0
- package/core/error-handler.d.ts.map +1 -0
- package/core/error-handler.js +291 -0
- package/core/error-handler.js.map +1 -0
- package/core/federated-learning.d.ts +124 -0
- package/core/federated-learning.d.ts.map +1 -0
- package/core/federated-learning.js +338 -0
- package/core/federated-learning.js.map +1 -0
- package/core/fingerprint.d.ts +95 -0
- package/core/fingerprint.d.ts.map +1 -0
- package/core/fingerprint.js +313 -0
- package/core/fingerprint.js.map +1 -0
- package/core/geoip.d.ts +67 -0
- package/core/geoip.d.ts.map +1 -0
- package/core/geoip.js +174 -0
- package/core/geoip.js.map +1 -0
- package/core/gossip.d.ts +141 -0
- package/core/gossip.d.ts.map +1 -0
- package/core/gossip.js +372 -0
- package/core/gossip.js.map +1 -0
- package/core/governance.d.ts +147 -0
- package/core/governance.d.ts.map +1 -0
- package/core/governance.js +351 -0
- package/core/governance.js.map +1 -0
- package/core/indexer-enhancements.d.ts +164 -0
- package/core/indexer-enhancements.d.ts.map +1 -0
- package/core/indexer-enhancements.js +429 -0
- package/core/indexer-enhancements.js.map +1 -0
- package/core/intrusion-detection.d.ts +79 -0
- package/core/intrusion-detection.d.ts.map +1 -0
- package/core/intrusion-detection.js +322 -0
- package/core/intrusion-detection.js.map +1 -0
- package/core/lifecycle.d.ts +118 -0
- package/core/lifecycle.d.ts.map +1 -0
- package/core/lifecycle.js +310 -0
- package/core/lifecycle.js.map +1 -0
- package/core/location.d.ts +99 -0
- package/core/location.d.ts.map +1 -0
- package/core/location.js +219 -0
- package/core/location.js.map +1 -0
- package/core/maxmind-integration.d.ts +68 -0
- package/core/maxmind-integration.d.ts.map +1 -0
- package/core/maxmind-integration.js +245 -0
- package/core/maxmind-integration.js.map +1 -0
- package/core/migration.d.ts +58 -0
- package/core/migration.d.ts.map +1 -0
- package/core/migration.js +223 -0
- package/core/migration.js.map +1 -0
- package/core/monitoring.d.ts +153 -0
- package/core/monitoring.d.ts.map +1 -0
- package/core/monitoring.js +406 -0
- package/core/monitoring.js.map +1 -0
- package/core/offsite-backup.d.ts +71 -0
- package/core/offsite-backup.d.ts.map +1 -0
- package/core/offsite-backup.js +341 -0
- package/core/offsite-backup.js.map +1 -0
- package/core/order-intent-store.js +83 -0
- package/core/order-intent.js +273 -0
- package/core/paths.js +116 -0
- package/core/performance.d.ts +173 -0
- package/core/performance.d.ts.map +1 -0
- package/core/performance.js +386 -0
- package/core/performance.js.map +1 -0
- package/core/product-flag.d.ts +364 -0
- package/core/product-flag.d.ts.map +1 -0
- package/core/product-flag.js +465 -0
- package/core/product-flag.js.map +1 -0
- package/core/protection.d.ts +139 -0
- package/core/protection.d.ts.map +1 -0
- package/core/protection.js +327 -0
- package/core/protection.js.map +1 -0
- package/core/region-adapter.d.ts +152 -0
- package/core/region-adapter.d.ts.map +1 -0
- package/core/region-adapter.js +505 -0
- package/core/region-adapter.js.map +1 -0
- package/core/region-configs.d.ts +12 -0
- package/core/region-configs.d.ts.map +1 -0
- package/core/region-configs.js +907 -0
- package/core/region-configs.js.map +1 -0
- package/core/review-antifraud.d.ts +80 -0
- package/core/review-antifraud.d.ts.map +1 -0
- package/core/review-antifraud.js +193 -0
- package/core/review-antifraud.js.map +1 -0
- package/core/rules-updater.d.ts +89 -0
- package/core/rules-updater.d.ts.map +1 -0
- package/core/rules-updater.js +261 -0
- package/core/rules-updater.js.map +1 -0
- package/core/runtime-data.js +203 -0
- package/core/security.d.ts +144 -0
- package/core/security.d.ts.map +1 -0
- package/core/security.js +390 -0
- package/core/security.js.map +1 -0
- package/core/seller-identity.js +78 -0
- package/core/session-manager.d.ts +93 -0
- package/core/session-manager.d.ts.map +1 -0
- package/core/session-manager.js +262 -0
- package/core/session-manager.js.map +1 -0
- package/core/state-sync.d.ts +121 -0
- package/core/state-sync.d.ts.map +1 -0
- package/core/state-sync.js +287 -0
- package/core/state-sync.js.map +1 -0
- package/core/testing.d.ts +97 -0
- package/core/testing.d.ts.map +1 -0
- package/core/testing.js +361 -0
- package/core/testing.js.map +1 -0
- package/core/trust-score.d.ts +51 -0
- package/core/trust-score.d.ts.map +1 -0
- package/core/trust-score.js +188 -0
- package/core/trust-score.js.map +1 -0
- package/core/trustworthiness.d.ts +140 -0
- package/core/trustworthiness.d.ts.map +1 -0
- package/core/trustworthiness.js +375 -0
- package/core/trustworthiness.js.map +1 -0
- package/core/types.d.ts +258 -0
- package/core/types.d.ts.map +1 -0
- package/core/types.js +9 -0
- package/core/types.js.map +1 -0
- package/core/upgrade-manager.d.ts +114 -0
- package/core/upgrade-manager.d.ts.map +1 -0
- package/core/upgrade-manager.js +264 -0
- package/core/upgrade-manager.js.map +1 -0
- package/core/upgrader.d.ts +107 -0
- package/core/upgrader.d.ts.map +1 -0
- package/core/upgrader.js +389 -0
- package/core/upgrader.js.map +1 -0
- package/core/websocket.d.ts +78 -0
- package/core/websocket.d.ts.map +1 -0
- package/core/websocket.js +292 -0
- package/core/websocket.js.map +1 -0
- package/council/hidden-weight.d.ts +45 -0
- package/council/hidden-weight.d.ts.map +1 -0
- package/council/hidden-weight.js +135 -0
- package/council/hidden-weight.js.map +1 -0
- package/db/email-migrations.sql +31 -0
- package/db/oauth-migrate.d.ts +39 -0
- package/db/oauth-migrate.d.ts.map +1 -0
- package/db/oauth-migrate.js +201 -0
- package/db/oauth-migrate.js.map +1 -0
- package/db/oauth-migrations.sql +92 -0
- package/db/social-migrate.d.ts +12 -0
- package/db/social-migrate.d.ts.map +1 -0
- package/db/social-migrate.js +102 -0
- package/db/social-migrate.js.map +1 -0
- package/db/social-migrations.sql +94 -0
- package/db/store-migrate.d.ts +33 -0
- package/db/store-migrate.d.ts.map +1 -0
- package/db/store-migrate.js +149 -0
- package/db/store-migrate.js.map +1 -0
- package/db/store-migrations.sql +242 -0
- package/debug.d.ts +2 -0
- package/debug.d.ts.map +1 -0
- package/debug.js +18 -0
- package/debug.js.map +1 -0
- package/event-listener.d.ts +93 -0
- package/event-listener.d.ts.map +1 -0
- package/event-listener.js +321 -0
- package/event-listener.js.map +1 -0
- package/event-whitelist.d.ts +79 -0
- package/event-whitelist.d.ts.map +1 -0
- package/event-whitelist.js +533 -0
- package/event-whitelist.js.map +1 -0
- package/index.d.ts +45 -0
- package/index.d.ts.map +1 -0
- package/index.js +361 -0
- package/index.js.map +1 -0
- package/init-node.d.ts +9 -0
- package/init-node.d.ts.map +1 -0
- package/init-node.js +230 -0
- package/init-node.js.map +1 -0
- package/mcp/ai-tools.d.ts +2 -0
- package/mcp/ai-tools.d.ts.map +1 -0
- package/mcp/ai-tools.js +266 -0
- package/mcp/ai-tools.js.map +1 -0
- package/mcp/auto-dispatch-tools.d.ts +2 -0
- package/mcp/auto-dispatch-tools.d.ts.map +1 -0
- package/mcp/auto-dispatch-tools.js +348 -0
- package/mcp/auto-dispatch-tools.js.map +1 -0
- package/mcp/business-scope-tools.d.ts +11 -0
- package/mcp/business-scope-tools.d.ts.map +1 -0
- package/mcp/business-scope-tools.js +179 -0
- package/mcp/business-scope-tools.js.map +1 -0
- package/mcp/buyer-tools.d.ts +67 -0
- package/mcp/buyer-tools.d.ts.map +1 -0
- package/mcp/buyer-tools.js +445 -0
- package/mcp/buyer-tools.js.map +1 -0
- package/mcp/interfaces.d.ts +1058 -0
- package/mcp/interfaces.d.ts.map +1 -0
- package/mcp/interfaces.js +13 -0
- package/mcp/interfaces.js.map +1 -0
- package/mcp/m2m-chat-tool.d.ts +50 -0
- package/mcp/m2m-chat-tool.d.ts.map +1 -0
- package/mcp/m2m-chat-tool.js +432 -0
- package/mcp/m2m-chat-tool.js.map +1 -0
- package/mcp/migrations.d.ts +30 -0
- package/mcp/migrations.d.ts.map +1 -0
- package/mcp/migrations.js +391 -0
- package/mcp/migrations.js.map +1 -0
- package/mcp/peer-tools.d.ts +163 -0
- package/mcp/peer-tools.d.ts.map +1 -0
- package/mcp/peer-tools.js +532 -0
- package/mcp/peer-tools.js.map +1 -0
- package/mcp/plugin-management-tools.d.ts +2 -0
- package/mcp/plugin-management-tools.d.ts.map +1 -0
- package/mcp/plugin-management-tools.js +327 -0
- package/mcp/plugin-management-tools.js.map +1 -0
- package/mcp/product-type-tools.d.ts +2 -0
- package/mcp/product-type-tools.d.ts.map +1 -0
- package/mcp/product-type-tools.js +470 -0
- package/mcp/product-type-tools.js.map +1 -0
- package/mcp/security-tools.d.ts +2 -0
- package/mcp/security-tools.d.ts.map +1 -0
- package/mcp/security-tools.js +313 -0
- package/mcp/security-tools.js.map +1 -0
- package/mcp/seller-query-tools.d.ts +2 -0
- package/mcp/seller-query-tools.d.ts.map +1 -0
- package/mcp/seller-query-tools.js +179 -0
- package/mcp/seller-query-tools.js.map +1 -0
- package/mcp/server.d.ts +11 -0
- package/mcp/server.d.ts.map +1 -0
- package/mcp/server.js +68 -0
- package/mcp/server.js.map +1 -0
- package/mcp/standalone-server.d.ts +34 -0
- package/mcp/standalone-server.d.ts.map +1 -0
- package/mcp/standalone-server.js +261 -0
- package/mcp/standalone-server.js.map +1 -0
- package/mcp/tools-integration.d.ts +31 -0
- package/mcp/tools-integration.d.ts.map +1 -0
- package/mcp/tools-integration.js +288 -0
- package/mcp/tools-integration.js.map +1 -0
- package/mcp/web-panel.d.ts +18 -0
- package/mcp/web-panel.d.ts.map +1 -0
- package/mcp/web-panel.js +1657 -0
- package/mcp/web-panel.js.map +1 -0
- package/middleware/api-key-auth.d.ts +64 -0
- package/middleware/api-key-auth.d.ts.map +1 -0
- package/middleware/api-key-auth.js +255 -0
- package/middleware/api-key-auth.js.map +1 -0
- package/middleware/scope-auth.d.ts +54 -0
- package/middleware/scope-auth.d.ts.map +1 -0
- package/middleware/scope-auth.js +153 -0
- package/middleware/scope-auth.js.map +1 -0
- package/middleware/security.d.ts +48 -0
- package/middleware/security.d.ts.map +1 -0
- package/middleware/security.js +217 -0
- package/middleware/security.js.map +1 -0
- package/middleware/wallet-auth.d.ts +54 -0
- package/middleware/wallet-auth.d.ts.map +1 -0
- package/middleware/wallet-auth.js +158 -0
- package/middleware/wallet-auth.js.map +1 -0
- package/oauth/chain-revocation-sink.d.ts +24 -0
- package/oauth/chain-revocation-sink.d.ts.map +1 -0
- package/oauth/chain-revocation-sink.js +47 -0
- package/oauth/chain-revocation-sink.js.map +1 -0
- package/oauth/gossip-sync.d.ts +25 -0
- package/oauth/gossip-sync.d.ts.map +1 -0
- package/oauth/gossip-sync.js +62 -0
- package/oauth/gossip-sync.js.map +1 -0
- package/oauth/issuer-keys.d.ts +31 -0
- package/oauth/issuer-keys.d.ts.map +1 -0
- package/oauth/issuer-keys.js +117 -0
- package/oauth/issuer-keys.js.map +1 -0
- package/oauth/peer-resolver.d.ts +25 -0
- package/oauth/peer-resolver.d.ts.map +1 -0
- package/oauth/peer-resolver.js +81 -0
- package/oauth/peer-resolver.js.map +1 -0
- package/oauth/revocation-store.d.ts +58 -0
- package/oauth/revocation-store.d.ts.map +1 -0
- package/oauth/revocation-store.js +86 -0
- package/oauth/revocation-store.js.map +1 -0
- package/oauth/token-v2.d.ts +101 -0
- package/oauth/token-v2.d.ts.map +1 -0
- package/oauth/token-v2.js +167 -0
- package/oauth/token-v2.js.map +1 -0
- package/oracle/c5-glue.js +603 -0
- package/oracle/ops-console.js +623 -0
- package/oracle/oracle-sync.d.ts +29 -0
- package/oracle/oracle-sync.d.ts.map +1 -0
- package/oracle/oracle-sync.js +445 -0
- package/oracle/oracle-sync.js.map +1 -0
- package/oracle/registry.d.ts +30 -0
- package/oracle/registry.d.ts.map +1 -0
- package/oracle/registry.js +62 -0
- package/oracle/registry.js.map +1 -0
- package/p2p/availability.d.ts +188 -0
- package/p2p/availability.d.ts.map +1 -0
- package/p2p/availability.js +574 -0
- package/p2p/availability.js.map +1 -0
- package/p2p/bootstrap.d.ts +42 -0
- package/p2p/bootstrap.d.ts.map +1 -0
- package/p2p/bootstrap.js +146 -0
- package/p2p/bootstrap.js.map +1 -0
- package/p2p/buyer-client.d.ts +98 -0
- package/p2p/buyer-client.d.ts.map +1 -0
- package/p2p/buyer-client.js +199 -0
- package/p2p/buyer-client.js.map +1 -0
- package/p2p/cdn-ddns.d.ts +208 -0
- package/p2p/cdn-ddns.d.ts.map +1 -0
- package/p2p/cdn-ddns.js +500 -0
- package/p2p/cdn-ddns.js.map +1 -0
- package/p2p/cluster-sync.d.ts +115 -0
- package/p2p/cluster-sync.d.ts.map +1 -0
- package/p2p/cluster-sync.js +330 -0
- package/p2p/cluster-sync.js.map +1 -0
- package/p2p/consistency-check.d.ts +30 -0
- package/p2p/consistency-check.d.ts.map +1 -0
- package/p2p/consistency-check.js +168 -0
- package/p2p/consistency-check.js.map +1 -0
- package/p2p/endpoint-registry.d.ts +41 -0
- package/p2p/endpoint-registry.d.ts.map +1 -0
- package/p2p/endpoint-registry.js +128 -0
- package/p2p/endpoint-registry.js.map +1 -0
- package/p2p/ipv6.d.ts +120 -0
- package/p2p/ipv6.d.ts.map +1 -0
- package/p2p/ipv6.js +425 -0
- package/p2p/ipv6.js.map +1 -0
- package/p2p/protocol.d.ts +100 -0
- package/p2p/protocol.d.ts.map +1 -0
- package/p2p/protocol.js +330 -0
- package/p2p/protocol.js.map +1 -0
- package/p2p/reliability.d.ts +56 -0
- package/p2p/reliability.d.ts.map +1 -0
- package/p2p/reliability.js +240 -0
- package/p2p/reliability.js.map +1 -0
- package/p2p/seller-service.d.ts +53 -0
- package/p2p/seller-service.d.ts.map +1 -0
- package/p2p/seller-service.js +276 -0
- package/p2p/seller-service.js.map +1 -0
- package/p2p/signing.d.ts +31 -0
- package/p2p/signing.d.ts.map +1 -0
- package/p2p/signing.js +95 -0
- package/p2p/signing.js.map +1 -0
- package/package.json +73 -0
- package/payment/api.d.ts +9 -0
- package/payment/api.d.ts.map +1 -0
- package/payment/api.js +141 -0
- package/payment/api.js.map +1 -0
- package/payment/gateway.d.ts +114 -0
- package/payment/gateway.d.ts.map +1 -0
- package/payment/gateway.js +231 -0
- package/payment/gateway.js.map +1 -0
- package/payments/alipay/index.d.ts +18 -0
- package/payments/alipay/index.d.ts.map +1 -0
- package/payments/alipay/index.js +55 -0
- package/payments/alipay/index.js.map +1 -0
- package/payments/base.d.ts +13 -0
- package/payments/base.d.ts.map +1 -0
- package/payments/base.js +28 -0
- package/payments/base.js.map +1 -0
- package/payments/index.d.ts +18 -0
- package/payments/index.d.ts.map +1 -0
- package/payments/index.js +66 -0
- package/payments/index.js.map +1 -0
- package/payments/template/index.d.ts +18 -0
- package/payments/template/index.d.ts.map +1 -0
- package/payments/template/index.js +57 -0
- package/payments/template/index.js.map +1 -0
- package/payments/types.d.ts +42 -0
- package/payments/types.d.ts.map +1 -0
- package/payments/types.js +3 -0
- package/payments/types.js.map +1 -0
- package/payments/wechat/index.d.ts +18 -0
- package/payments/wechat/index.d.ts.map +1 -0
- package/payments/wechat/index.js +54 -0
- package/payments/wechat/index.js.map +1 -0
- package/peer/chain-signer.d.ts +74 -0
- package/peer/chain-signer.d.ts.map +1 -0
- package/peer/chain-signer.js +149 -0
- package/peer/chain-signer.js.map +1 -0
- package/peer/config.d.ts +71 -0
- package/peer/config.d.ts.map +1 -0
- package/peer/config.js +61 -0
- package/peer/config.js.map +1 -0
- package/peer/index.d.ts +12 -0
- package/peer/index.d.ts.map +1 -0
- package/peer/index.js +46 -0
- package/peer/index.js.map +1 -0
- package/peer/key-store.d.ts +66 -0
- package/peer/key-store.d.ts.map +1 -0
- package/peer/key-store.js +163 -0
- package/peer/key-store.js.map +1 -0
- package/peer/proto-codec.d.ts +103 -0
- package/peer/proto-codec.d.ts.map +1 -0
- package/peer/proto-codec.js +423 -0
- package/peer/proto-codec.js.map +1 -0
- package/peer/registrar.d.ts +88 -0
- package/peer/registrar.d.ts.map +1 -0
- package/peer/registrar.js +271 -0
- package/peer/registrar.js.map +1 -0
- package/peer/registry.d.ts +31 -0
- package/peer/registry.d.ts.map +1 -0
- package/peer/registry.js +143 -0
- package/peer/registry.js.map +1 -0
- package/plugins/auth.d.ts +193 -0
- package/plugins/auth.d.ts.map +1 -0
- package/plugins/auth.js +923 -0
- package/plugins/auth.js.map +1 -0
- package/plugins/manager.d.ts +37 -0
- package/plugins/manager.d.ts.map +1 -0
- package/plugins/manager.js +83 -0
- package/plugins/manager.js.map +1 -0
- package/plugins/oauth.d.ts +249 -0
- package/plugins/oauth.d.ts.map +1 -0
- package/plugins/oauth.js +979 -0
- package/plugins/oauth.js.map +1 -0
- package/plugins/p2p-message.d.ts +133 -0
- package/plugins/p2p-message.d.ts.map +1 -0
- package/plugins/p2p-message.js +443 -0
- package/plugins/p2p-message.js.map +1 -0
- package/plugins/postgresql.d.ts +54 -0
- package/plugins/postgresql.d.ts.map +1 -0
- package/plugins/postgresql.js +743 -0
- package/plugins/postgresql.js.map +1 -0
- package/plugins/relationship.d.ts +141 -0
- package/plugins/relationship.d.ts.map +1 -0
- package/plugins/relationship.js +395 -0
- package/plugins/relationship.js.map +1 -0
- package/plugins/sqlite.d.ts +200 -0
- package/plugins/sqlite.d.ts.map +1 -0
- package/plugins/sqlite.js +2412 -0
- package/plugins/sqlite.js.map +1 -0
- package/port-manager/disguise/ssh.d.ts +19 -0
- package/port-manager/disguise/ssh.d.ts.map +1 -0
- package/port-manager/disguise/ssh.js +104 -0
- package/port-manager/disguise/ssh.js.map +1 -0
- package/port-manager/port-manager.d.ts +65 -0
- package/port-manager/port-manager.d.ts.map +1 -0
- package/port-manager/port-manager.js +164 -0
- package/port-manager/port-manager.js.map +1 -0
- package/port-manager/port-scanner.d.ts +22 -0
- package/port-manager/port-scanner.d.ts.map +1 -0
- package/port-manager/port-scanner.js +187 -0
- package/port-manager/port-scanner.js.map +1 -0
- package/port-manager/types.d.ts +51 -0
- package/port-manager/types.d.ts.map +1 -0
- package/port-manager/types.js +6 -0
- package/port-manager/types.js.map +1 -0
- package/proto/amino/amino.proto +84 -0
- package/proto/cosmos/base/v1beta1/coin.proto +61 -0
- package/proto/cosmos/msg/v1/msg.proto +30 -0
- package/proto/cosmos_proto/cosmos.proto +112 -0
- package/proto/gogoproto/gogo.proto +145 -0
- package/proto/google/protobuf/descriptor.proto +1218 -0
- package/proto/trustchain/economy/v1/params.proto +133 -0
- package/proto/trustchain/economy/v1/tx.proto +162 -0
- package/proto/trustchain/marketplace/v1/params.proto +64 -0
- package/proto/trustchain/marketplace/v1/product.proto +21 -0
- package/proto/trustchain/marketplace/v1/tx.proto +131 -0
- package/proto/trustchain/order/v1/params.proto +94 -0
- package/proto/trustchain/order/v1/tx.proto +156 -0
- package/proto/trustchain/serviceprovider/v1/paymentfact.proto +32 -0
- package/proto/trustchain/serviceprovider/v1/serviceprovider.proto +38 -0
- package/proto/trustchain/serviceprovider/v1/tx.proto +106 -0
- package/proto/trustchain/subchain/v1/params.proto +26 -0
- package/proto/trustchain/subchain/v1/pool.proto +53 -0
- package/proto/trustchain/subchain/v1/tx.proto +159 -0
- package/proto/trustchain/trustcoin/v1/business_scope.proto +126 -0
- package/proto/trustchain/trustcoin/v1/genesis.proto +33 -0
- package/proto/trustchain/trustcoin/v1/params.proto +86 -0
- package/proto/trustchain/trustcoin/v1/query.proto +95 -0
- package/proto/trustchain/trustcoin/v1/tx.proto +160 -0
- package/proto/trustchain/verification/v1/params.proto +46 -0
- package/proto/trustchain/verification/v1/tx.proto +126 -0
- package/proto/trustchain/verification/v1/verification.proto +105 -0
- package/relationship-chain-api.d.ts +13 -0
- package/relationship-chain-api.d.ts.map +1 -0
- package/relationship-chain-api.js +139 -0
- package/relationship-chain-api.js.map +1 -0
- package/relationship-chain.d.ts +90 -0
- package/relationship-chain.d.ts.map +1 -0
- package/relationship-chain.js +201 -0
- package/relationship-chain.js.map +1 -0
- package/routes/agent-pay.js +419 -0
- package/routes/agent-serviceprovider.js +183 -0
- package/routes/ai.d.ts +54 -0
- package/routes/ai.d.ts.map +1 -0
- package/routes/ai.js +293 -0
- package/routes/ai.js.map +1 -0
- package/routes/api-keys.d.ts +12 -0
- package/routes/api-keys.d.ts.map +1 -0
- package/routes/api-keys.js +163 -0
- package/routes/api-keys.js.map +1 -0
- package/routes/app-store.d.ts +12 -0
- package/routes/app-store.d.ts.map +1 -0
- package/routes/app-store.js +207 -0
- package/routes/app-store.js.map +1 -0
- package/routes/auth-management.d.ts +17 -0
- package/routes/auth-management.d.ts.map +1 -0
- package/routes/auth-management.js +257 -0
- package/routes/auth-management.js.map +1 -0
- package/routes/auth.d.ts +9 -0
- package/routes/auth.d.ts.map +1 -0
- package/routes/auth.js +846 -0
- package/routes/auth.js.map +1 -0
- package/routes/brand.d.ts +3 -0
- package/routes/brand.d.ts.map +1 -0
- package/routes/brand.js +109 -0
- package/routes/brand.js.map +1 -0
- package/routes/chain-registry.d.ts +11 -0
- package/routes/chain-registry.d.ts.map +1 -0
- package/routes/chain-registry.js +51 -0
- package/routes/chain-registry.js.map +1 -0
- package/routes/chain-writes-insurance.d.ts +17 -0
- package/routes/chain-writes-insurance.d.ts.map +1 -0
- package/routes/chain-writes-insurance.js +69 -0
- package/routes/chain-writes-insurance.js.map +1 -0
- package/routes/chain-writes-pledge.d.ts +34 -0
- package/routes/chain-writes-pledge.d.ts.map +1 -0
- package/routes/chain-writes-pledge.js +206 -0
- package/routes/chain-writes-pledge.js.map +1 -0
- package/routes/chain-writes-products.d.ts +66 -0
- package/routes/chain-writes-products.d.ts.map +1 -0
- package/routes/chain-writes-products.js +394 -0
- package/routes/chain-writes-products.js.map +1 -0
- package/routes/chain-writes.d.ts +78 -0
- package/routes/chain-writes.d.ts.map +1 -0
- package/routes/chain-writes.js +658 -0
- package/routes/chain-writes.js.map +1 -0
- package/routes/chain.d.ts +10 -0
- package/routes/chain.d.ts.map +1 -0
- package/routes/chain.js +45 -0
- package/routes/chain.js.map +1 -0
- package/routes/compliance.d.ts +3 -0
- package/routes/compliance.d.ts.map +1 -0
- package/routes/compliance.js +53 -0
- package/routes/compliance.js.map +1 -0
- package/routes/council.d.ts +3 -0
- package/routes/council.d.ts.map +1 -0
- package/routes/council.js +477 -0
- package/routes/council.js.map +1 -0
- package/routes/crosschain.d.ts +11 -0
- package/routes/crosschain.d.ts.map +1 -0
- package/routes/crosschain.js +39 -0
- package/routes/crosschain.js.map +1 -0
- package/routes/device.d.ts +3 -0
- package/routes/device.d.ts.map +1 -0
- package/routes/device.js +73 -0
- package/routes/device.js.map +1 -0
- package/routes/devreward.d.ts +54 -0
- package/routes/devreward.d.ts.map +1 -0
- package/routes/devreward.js +129 -0
- package/routes/devreward.js.map +1 -0
- package/routes/economy.d.ts +50 -0
- package/routes/economy.d.ts.map +1 -0
- package/routes/economy.js +273 -0
- package/routes/economy.js.map +1 -0
- package/routes/flowback.d.ts +32 -0
- package/routes/flowback.d.ts.map +1 -0
- package/routes/flowback.js +97 -0
- package/routes/flowback.js.map +1 -0
- package/routes/insurance.d.ts +10 -0
- package/routes/insurance.d.ts.map +1 -0
- package/routes/insurance.js +70 -0
- package/routes/insurance.js.map +1 -0
- package/routes/m2m-viewer.js +195 -0
- package/routes/m2m.d.ts +10 -0
- package/routes/m2m.d.ts.map +1 -0
- package/routes/m2m.js +31 -0
- package/routes/m2m.js.map +1 -0
- package/routes/marketplace.d.ts +15 -0
- package/routes/marketplace.d.ts.map +1 -0
- package/routes/marketplace.js +396 -0
- package/routes/marketplace.js.map +1 -0
- package/routes/node-config.d.ts +6 -0
- package/routes/node-config.d.ts.map +1 -0
- package/routes/node-config.js +500 -0
- package/routes/node-config.js.map +1 -0
- package/routes/oauth-revocation.d.ts +42 -0
- package/routes/oauth-revocation.d.ts.map +1 -0
- package/routes/oauth-revocation.js +99 -0
- package/routes/oauth-revocation.js.map +1 -0
- package/routes/oauth.d.ts +17 -0
- package/routes/oauth.d.ts.map +1 -0
- package/routes/oauth.js +700 -0
- package/routes/oauth.js.map +1 -0
- package/routes/onboard.html +352 -0
- package/routes/onboard.js +435 -0
- package/routes/order.d.ts +8 -0
- package/routes/order.d.ts.map +1 -0
- package/routes/order.js +607 -0
- package/routes/order.js.map +1 -0
- package/routes/p2p-api.d.ts +33 -0
- package/routes/p2p-api.d.ts.map +1 -0
- package/routes/p2p-api.js +274 -0
- package/routes/p2p-api.js.map +1 -0
- package/routes/p2p-message.d.ts +20 -0
- package/routes/p2p-message.d.ts.map +1 -0
- package/routes/p2p-message.js +237 -0
- package/routes/p2p-message.js.map +1 -0
- package/routes/peer.d.ts +22 -0
- package/routes/peer.d.ts.map +1 -0
- package/routes/peer.js +220 -0
- package/routes/peer.js.map +1 -0
- package/routes/plugins.d.ts +4 -0
- package/routes/plugins.d.ts.map +1 -0
- package/routes/plugins.js +138 -0
- package/routes/plugins.js.map +1 -0
- package/routes/port-manager.d.ts +6 -0
- package/routes/port-manager.d.ts.map +1 -0
- package/routes/port-manager.js +212 -0
- package/routes/port-manager.js.map +1 -0
- package/routes/relationship.d.ts +7 -0
- package/routes/relationship.d.ts.map +1 -0
- package/routes/relationship.js +314 -0
- package/routes/relationship.js.map +1 -0
- package/routes/relay.d.ts +3 -0
- package/routes/relay.d.ts.map +1 -0
- package/routes/relay.js +182 -0
- package/routes/relay.js.map +1 -0
- package/routes/reputation.d.ts +10 -0
- package/routes/reputation.d.ts.map +1 -0
- package/routes/reputation.js +141 -0
- package/routes/reputation.js.map +1 -0
- package/routes/reward.d.ts +3 -0
- package/routes/reward.d.ts.map +1 -0
- package/routes/reward.js +130 -0
- package/routes/reward.js.map +1 -0
- package/routes/security-monitoring.d.ts +12 -0
- package/routes/security-monitoring.d.ts.map +1 -0
- package/routes/security-monitoring.js +373 -0
- package/routes/security-monitoring.js.map +1 -0
- package/routes/shop.d.ts +8 -0
- package/routes/shop.d.ts.map +1 -0
- package/routes/shop.js +164 -0
- package/routes/shop.js.map +1 -0
- package/routes/social.d.ts +22 -0
- package/routes/social.d.ts.map +1 -0
- package/routes/social.js +95 -0
- package/routes/social.js.map +1 -0
- package/routes/subchain.d.ts +18 -0
- package/routes/subchain.d.ts.map +1 -0
- package/routes/subchain.js +106 -0
- package/routes/subchain.js.map +1 -0
- package/routes/trustcoin.d.ts +17 -0
- package/routes/trustcoin.d.ts.map +1 -0
- package/routes/trustcoin.js +149 -0
- package/routes/trustcoin.js.map +1 -0
- package/routes/twofa.d.ts +7 -0
- package/routes/twofa.d.ts.map +1 -0
- package/routes/twofa.js +105 -0
- package/routes/twofa.js.map +1 -0
- package/routes/verification.d.ts +8 -0
- package/routes/verification.d.ts.map +1 -0
- package/routes/verification.js +234 -0
- package/routes/verification.js.map +1 -0
- package/routes/wallet.d.ts +4 -0
- package/routes/wallet.d.ts.map +1 -0
- package/routes/wallet.js +770 -0
- package/routes/wallet.js.map +1 -0
- package/run-auth.d.ts +8 -0
- package/run-auth.d.ts.map +1 -0
- package/run-auth.js +82 -0
- package/run-auth.js.map +1 -0
- package/run-p2p-message.d.ts +8 -0
- package/run-p2p-message.d.ts.map +1 -0
- package/run-p2p-message.js +82 -0
- package/run-p2p-message.js.map +1 -0
- package/run-relationship.d.ts +12 -0
- package/run-relationship.d.ts.map +1 -0
- package/run-relationship.js +182 -0
- package/run-relationship.js.map +1 -0
- package/run-unified.d.ts +13 -0
- package/run-unified.d.ts.map +1 -0
- package/run-unified.js +1067 -0
- package/run-unified.js.map +1 -0
- package/run.d.ts +12 -0
- package/run.d.ts.map +1 -0
- package/run.js +889 -0
- package/run.js.map +1 -0
- package/search/ranking.d.ts +55 -0
- package/search/ranking.d.ts.map +1 -0
- package/search/ranking.js +67 -0
- package/search/ranking.js.map +1 -0
- package/shipping/base.d.ts +15 -0
- package/shipping/base.d.ts.map +1 -0
- package/shipping/base.js +39 -0
- package/shipping/base.js.map +1 -0
- package/shipping/index.d.ts +19 -0
- package/shipping/index.d.ts.map +1 -0
- package/shipping/index.js +72 -0
- package/shipping/index.js.map +1 -0
- package/shipping/sf-express/index.d.ts +23 -0
- package/shipping/sf-express/index.d.ts.map +1 -0
- package/shipping/sf-express/index.js +71 -0
- package/shipping/sf-express/index.js.map +1 -0
- package/shipping/template/index.d.ts +20 -0
- package/shipping/template/index.d.ts.map +1 -0
- package/shipping/template/index.js +74 -0
- package/shipping/template/index.js.map +1 -0
- package/shipping/types.d.ts +71 -0
- package/shipping/types.d.ts.map +1 -0
- package/shipping/types.js +6 -0
- package/shipping/types.js.map +1 -0
- package/shipping/virtual/index.d.ts +19 -0
- package/shipping/virtual/index.d.ts.map +1 -0
- package/shipping/virtual/index.js +54 -0
- package/shipping/virtual/index.js.map +1 -0
- package/shipping/yto/index.d.ts +18 -0
- package/shipping/yto/index.d.ts.map +1 -0
- package/shipping/yto/index.js +59 -0
- package/shipping/yto/index.js.map +1 -0
- package/shipping/zto/index.d.ts +18 -0
- package/shipping/zto/index.d.ts.map +1 -0
- package/shipping/zto/index.js +59 -0
- package/shipping/zto/index.js.map +1 -0
- package/skills-lock.json +11 -0
- package/src/db/email-migrations.sql +31 -0
- package/src/db/oauth-migrations.sql +92 -0
- package/src/db/social-migrations.sql +94 -0
- package/src/db/store-migrations.sql +242 -0
- package/test-api-key-revoke.js +167 -0
- package/test-auth-register-ratelimit.js +132 -0
- package/test-auth-tv2.d.ts +2 -0
- package/test-auth-tv2.d.ts.map +1 -0
- package/test-auth-tv2.js +174 -0
- package/test-auth-tv2.js.map +1 -0
- package/test-canonsign-cross.d.ts +2 -0
- package/test-canonsign-cross.d.ts.map +1 -0
- package/test-canonsign-cross.js +32 -0
- package/test-canonsign-cross.js.map +1 -0
- package/test-chain-signer.js +127 -0
- package/test-env-truthy.js +50 -0
- package/test-onboard-contract.js +94 -0
- package/test-ops-console-boundary.js +147 -0
- package/test-oracle-glue.js +232 -0
- package/test-order-create-v394.js +358 -0
- package/test-order-intent.js +245 -0
- package/test-order-lifecycle-v394.js +528 -0
- package/test-p2p-message.d.ts +13 -0
- package/test-p2p-message.d.ts.map +1 -0
- package/test-p2p-message.js +106 -0
- package/test-p2p-message.js.map +1 -0
- package/test-relationship-chain.d.ts +13 -0
- package/test-relationship-chain.d.ts.map +1 -0
- package/test-relationship-chain.js +103 -0
- package/test-relationship-chain.js.map +1 -0
- package/test-runtime-data-path.js +217 -0
- package/test-seller-identity.js +74 -0
- package/test-signing-paths.js +104 -0
- package/test-token-v2.d.ts +2 -0
- package/test-token-v2.d.ts.map +1 -0
- package/test-token-v2.js +172 -0
- package/test-token-v2.js.map +1 -0
- package/test-wallet-auth-nonce.d.ts +12 -0
- package/test-wallet-auth-nonce.d.ts.map +1 -0
- package/test-wallet-auth-nonce.js +126 -0
- package/test-wallet-auth-nonce.js.map +1 -0
- package/test-wallet-submatch.d.ts +13 -0
- package/test-wallet-submatch.d.ts.map +1 -0
- package/test-wallet-submatch.js +86 -0
- package/test-wallet-submatch.js.map +1 -0
- package/tls/self-signed.d.ts +12 -0
- package/tls/self-signed.d.ts.map +1 -0
- package/tls/self-signed.js +63 -0
- package/tls/self-signed.js.map +1 -0
- package/tools/brand.d.ts +11 -0
- package/tools/brand.d.ts.map +1 -0
- package/tools/brand.js +75 -0
- package/tools/brand.js.map +1 -0
- package/tools/chainregistry.d.ts +18 -0
- package/tools/chainregistry.d.ts.map +1 -0
- package/tools/chainregistry.js +175 -0
- package/tools/chainregistry.js.map +1 -0
- package/tools/compliance.d.ts +14 -0
- package/tools/compliance.d.ts.map +1 -0
- package/tools/compliance.js +45 -0
- package/tools/compliance.js.map +1 -0
- package/tools/council.d.ts +17 -0
- package/tools/council.d.ts.map +1 -0
- package/tools/council.js +75 -0
- package/tools/council.js.map +1 -0
- package/tools/device.d.ts +13 -0
- package/tools/device.d.ts.map +1 -0
- package/tools/device.js +45 -0
- package/tools/device.js.map +1 -0
- package/tools/devreward.d.ts +15 -0
- package/tools/devreward.d.ts.map +1 -0
- package/tools/devreward.js +190 -0
- package/tools/devreward.js.map +1 -0
- package/tools/economy.d.ts +14 -0
- package/tools/economy.d.ts.map +1 -0
- package/tools/economy.js +172 -0
- package/tools/economy.js.map +1 -0
- package/tools/flowback.d.ts +14 -0
- package/tools/flowback.d.ts.map +1 -0
- package/tools/flowback.js +146 -0
- package/tools/flowback.js.map +1 -0
- package/tools/insurance.d.ts +13 -0
- package/tools/insurance.d.ts.map +1 -0
- package/tools/insurance.js +45 -0
- package/tools/insurance.js.map +1 -0
- package/tools/marketplace.d.ts +12 -0
- package/tools/marketplace.d.ts.map +1 -0
- package/tools/marketplace.js +124 -0
- package/tools/marketplace.js.map +1 -0
- package/tools/order.d.ts +12 -0
- package/tools/order.d.ts.map +1 -0
- package/tools/order.js +94 -0
- package/tools/order.js.map +1 -0
- package/tools/recovery.d.ts +14 -0
- package/tools/recovery.d.ts.map +1 -0
- package/tools/recovery.js +158 -0
- package/tools/recovery.js.map +1 -0
- package/tools/relay.d.ts +15 -0
- package/tools/relay.d.ts.map +1 -0
- package/tools/relay.js +152 -0
- package/tools/relay.js.map +1 -0
- package/tools/reputation.d.ts +20 -0
- package/tools/reputation.d.ts.map +1 -0
- package/tools/reputation.js +50 -0
- package/tools/reputation.js.map +1 -0
- package/tools/reputation_seller_credit.d.ts +16 -0
- package/tools/reputation_seller_credit.d.ts.map +1 -0
- package/tools/reputation_seller_credit.js +106 -0
- package/tools/reputation_seller_credit.js.map +1 -0
- package/tools/reward.d.ts +14 -0
- package/tools/reward.d.ts.map +1 -0
- package/tools/reward.js +76 -0
- package/tools/reward.js.map +1 -0
- package/tools/shop.d.ts +14 -0
- package/tools/shop.d.ts.map +1 -0
- package/tools/shop.js +95 -0
- package/tools/shop.js.map +1 -0
- package/tools/verification.d.ts +12 -0
- package/tools/verification.d.ts.map +1 -0
- package/tools/verification.js +89 -0
- package/tools/verification.js.map +1 -0
- package/types/store.d.ts +255 -0
- package/types/store.d.ts.map +1 -0
- package/types/store.js +19 -0
- package/types/store.js.map +1 -0
- package/utils/aes-gcm.d.ts +63 -0
- package/utils/aes-gcm.d.ts.map +1 -0
- package/utils/aes-gcm.js +179 -0
- package/utils/aes-gcm.js.map +1 -0
- package/utils/api-response.d.ts +51 -0
- package/utils/api-response.d.ts.map +1 -0
- package/utils/api-response.js +65 -0
- package/utils/api-response.js.map +1 -0
- package/utils/base32.d.ts +5 -0
- package/utils/base32.d.ts.map +1 -0
- package/utils/base32.js +20 -0
- package/utils/base32.js.map +1 -0
- package/utils/crypto.d.ts +77 -0
- package/utils/crypto.d.ts.map +1 -0
- package/utils/crypto.js +164 -0
- package/utils/crypto.js.map +1 -0
- package/utils/encryption.d.ts +81 -0
- package/utils/encryption.d.ts.map +1 -0
- package/utils/encryption.js +247 -0
- package/utils/encryption.js.map +1 -0
- package/utils/env.js +20 -0
- package/utils/jwt.d.ts +110 -0
- package/utils/jwt.d.ts.map +1 -0
- package/utils/jwt.js +275 -0
- package/utils/jwt.js.map +1 -0
- package/utils/qrcode-reader.d.ts +22 -0
- package/utils/qrcode-reader.d.ts.map +1 -0
- package/utils/qrcode-reader.js +90 -0
- package/utils/qrcode-reader.js.map +1 -0
- package/utils/qrcode.d.ts +26 -0
- package/utils/qrcode.d.ts.map +1 -0
- package/utils/qrcode.js +92 -0
- package/utils/qrcode.js.map +1 -0
- package/utils/totp.d.ts +3 -0
- package/utils/totp.d.ts.map +1 -0
- package/utils/totp.js +58 -0
- package/utils/totp.js.map +1 -0
- package/utils/two-factor-auth.d.ts +16 -0
- package/utils/two-factor-auth.d.ts.map +1 -0
- package/utils/two-factor-auth.js +150 -0
- package/utils/two-factor-auth.js.map +1 -0
- package/verifyer/hsm.d.ts +70 -0
- package/verifyer/hsm.d.ts.map +1 -0
- package/verifyer/hsm.js +482 -0
- package/verifyer/hsm.js.map +1 -0
- package/verifyer/index.d.ts +81 -0
- package/verifyer/index.d.ts.map +1 -0
- package/verifyer/index.js +372 -0
- package/verifyer/index.js.map +1 -0
- package/ws/peer-monitor-broadcaster.d.ts +24 -0
- package/ws/peer-monitor-broadcaster.d.ts.map +1 -0
- package/ws/peer-monitor-broadcaster.js +56 -0
- package/ws/peer-monitor-broadcaster.js.map +1 -0
package/mcp/ai-tools.js
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// TrustCoin MCP Server - AI Integration Tools
|
|
3
|
+
// AI 模型接口配置工具
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.registerAITools = registerAITools;
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
function registerAITools(server, indexer) {
|
|
8
|
+
// Tool: 配置 AI 模型
|
|
9
|
+
server.tool('configure_ai_model', '配置 AI 模型接口', {
|
|
10
|
+
model_id: zod_1.z.string().describe('模型 ID'),
|
|
11
|
+
model_name: zod_1.z.string().describe('模型名称'),
|
|
12
|
+
model_type: zod_1.z.enum(['text_generation', 'image_generation', 'image_recognition', 'speech_recognition', 'speech_synthesis', 'translation', 'embedding', 'content_moderation', 'sentiment_analysis', 'other']).describe('模型类型'),
|
|
13
|
+
provider: zod_1.z.enum(['openai', 'anthropic', 'google', 'azure', 'zhipu', 'baidu', 'alibaba', 'tencent', 'custom']).describe('提供商'),
|
|
14
|
+
api_config: zod_1.z.object({
|
|
15
|
+
endpoint: zod_1.z.string().describe('API 端点'),
|
|
16
|
+
api_key: zod_1.z.string().describe('API Key'),
|
|
17
|
+
version: zod_1.z.string().optional().describe('API 版本'),
|
|
18
|
+
timeout: zod_1.z.number().optional().describe('超时时间'),
|
|
19
|
+
max_retries: zod_1.z.number().optional().describe('重试次数'),
|
|
20
|
+
}).describe('API 配置'),
|
|
21
|
+
parameters: zod_1.z.any().optional().describe('模型参数'),
|
|
22
|
+
limits: zod_1.z.any().optional().describe('使用限制'),
|
|
23
|
+
}, async ({ model_id, model_name, model_type, provider, api_config, parameters, limits }) => {
|
|
24
|
+
try {
|
|
25
|
+
const plugin = indexer?.getPlugin();
|
|
26
|
+
if (!plugin)
|
|
27
|
+
return { content: [{ type: 'text', text: '❌ 索引器未启动' }] };
|
|
28
|
+
const db = plugin.db;
|
|
29
|
+
if (!db)
|
|
30
|
+
return { content: [{ type: 'text', text: '❌ 数据库未初始化' }] };
|
|
31
|
+
const timestamp = new Date().toISOString();
|
|
32
|
+
// 检查模型是否已存在
|
|
33
|
+
const existing = db.prepare(`
|
|
34
|
+
SELECT * FROM ai_models WHERE model_id = ?
|
|
35
|
+
`).get(model_id);
|
|
36
|
+
if (existing) {
|
|
37
|
+
// 更新模型配置
|
|
38
|
+
db.prepare(`
|
|
39
|
+
UPDATE ai_models SET
|
|
40
|
+
model_name = ?, model_type = ?, provider = ?,
|
|
41
|
+
api_config = ?, parameters = ?, limits = ?,
|
|
42
|
+
status = 'active', updated_at = ?
|
|
43
|
+
WHERE model_id = ?
|
|
44
|
+
`).run(model_name, model_type, provider, JSON.stringify(api_config), JSON.stringify(parameters || {}), JSON.stringify(limits || {}), timestamp, model_id);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
// 创建新模型配置
|
|
48
|
+
db.prepare(`
|
|
49
|
+
INSERT INTO ai_models (
|
|
50
|
+
model_id, model_name, model_type, provider,
|
|
51
|
+
api_config, parameters, limits, status, created_at, updated_at
|
|
52
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
53
|
+
`).run(model_id, model_name, model_type, provider, JSON.stringify(api_config), JSON.stringify(parameters || {}), JSON.stringify(limits || {}), 'active', timestamp, timestamp);
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
content: [{
|
|
57
|
+
type: 'text',
|
|
58
|
+
text: JSON.stringify({
|
|
59
|
+
success: true,
|
|
60
|
+
model_id: model_id,
|
|
61
|
+
model_name: model_name,
|
|
62
|
+
model_type: model_type,
|
|
63
|
+
provider: provider,
|
|
64
|
+
status: 'active',
|
|
65
|
+
updated_at: timestamp,
|
|
66
|
+
message: 'AI 模型配置成功',
|
|
67
|
+
}, null, 2)
|
|
68
|
+
}]
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
return { content: [{ type: 'text', text: `❌ ${err.message}` }] };
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
// Tool: 调用 AI 模型
|
|
76
|
+
server.tool('call_ai_model', '调用 AI 模型接口', {
|
|
77
|
+
model_id: zod_1.z.string().describe('模型 ID'),
|
|
78
|
+
action: zod_1.z.enum(['generate_text', 'generate_image', 'recognize_image', 'recognize_speech', 'synthesize_speech', 'translate', 'moderate_content', 'analyze_sentiment']).describe('操作类型'),
|
|
79
|
+
request: zod_1.z.any().describe('请求数据'),
|
|
80
|
+
parameters: zod_1.z.any().optional().describe('可选参数'),
|
|
81
|
+
}, async ({ model_id, action, request, parameters }) => {
|
|
82
|
+
try {
|
|
83
|
+
const plugin = indexer?.getPlugin();
|
|
84
|
+
if (!plugin)
|
|
85
|
+
return { content: [{ type: 'text', text: '❌ 索引器未启动' }] };
|
|
86
|
+
const db = plugin.db;
|
|
87
|
+
if (!db)
|
|
88
|
+
return { content: [{ type: 'text', text: '❌ 数据库未初始化' }] };
|
|
89
|
+
// 获取模型配置
|
|
90
|
+
const model = db.prepare(`
|
|
91
|
+
SELECT * FROM ai_models WHERE model_id = ? AND status = 'active'
|
|
92
|
+
`).get(model_id);
|
|
93
|
+
if (!model) {
|
|
94
|
+
return { content: [{ type: 'text', text: `❌ 未找到模型: ${model_id}` }] };
|
|
95
|
+
}
|
|
96
|
+
const apiConfig = JSON.parse(model.api_config);
|
|
97
|
+
const modelParams = JSON.parse(model.parameters);
|
|
98
|
+
const timestamp = new Date().toISOString();
|
|
99
|
+
// 记录调用
|
|
100
|
+
const callId = generateCallId();
|
|
101
|
+
db.prepare(`
|
|
102
|
+
INSERT INTO ai_model_calls (
|
|
103
|
+
call_id, model_id, action, request, parameters, called_at
|
|
104
|
+
) VALUES (?, ?, ?, ?, ?, ?)
|
|
105
|
+
`).run(callId, model_id, action, JSON.stringify(request), JSON.stringify(parameters || {}), timestamp);
|
|
106
|
+
// 模拟调用结果(实际应该调用真实 API)
|
|
107
|
+
const result = {
|
|
108
|
+
call_id: callId,
|
|
109
|
+
model_id: model_id,
|
|
110
|
+
action: action,
|
|
111
|
+
result: {
|
|
112
|
+
text: `这是 ${model.model_name} 的模拟响应`,
|
|
113
|
+
usage: {
|
|
114
|
+
prompt_tokens: 100,
|
|
115
|
+
completion_tokens: 50,
|
|
116
|
+
total_tokens: 150,
|
|
117
|
+
},
|
|
118
|
+
cost: 0.001,
|
|
119
|
+
cost_unit: 'usd',
|
|
120
|
+
},
|
|
121
|
+
called_at: timestamp,
|
|
122
|
+
message: 'AI 模型调用成功(模拟)',
|
|
123
|
+
};
|
|
124
|
+
return {
|
|
125
|
+
content: [{
|
|
126
|
+
type: 'text',
|
|
127
|
+
text: JSON.stringify(result, null, 2)
|
|
128
|
+
}]
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
catch (err) {
|
|
132
|
+
return { content: [{ type: 'text', text: `❌ ${err.message}` }] };
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
// Tool: 配置 AI 场景
|
|
136
|
+
server.tool('configure_ai_scenario', '配置 AI 使用场景', {
|
|
137
|
+
scenario_id: zod_1.z.string().describe('场景 ID'),
|
|
138
|
+
scenario_name: zod_1.z.string().describe('场景名称'),
|
|
139
|
+
scenario_type: zod_1.z.enum(['product_description', 'product_title', 'product_tags', 'image_recognition', 'smart_customer_service', 'content_moderation', 'price_recommendation', 'translation', 'speech_recognition', 'smart_recommendation']).describe('场景类型'),
|
|
140
|
+
model_id: zod_1.z.string().describe('使用的模型 ID'),
|
|
141
|
+
enabled: zod_1.z.boolean().describe('是否启用'),
|
|
142
|
+
auto_trigger: zod_1.z.boolean().describe('是否自动触发'),
|
|
143
|
+
trigger_conditions: zod_1.z.any().optional().describe('触发条件'),
|
|
144
|
+
prompt_template: zod_1.z.string().optional().describe('提示词模板'),
|
|
145
|
+
cost_bearer: zod_1.z.enum(['seller', 'buyer', 'platform']).describe('费用承担方'),
|
|
146
|
+
}, async ({ scenario_id, scenario_name, scenario_type, model_id, enabled, auto_trigger, trigger_conditions, prompt_template, cost_bearer }) => {
|
|
147
|
+
try {
|
|
148
|
+
const plugin = indexer?.getPlugin();
|
|
149
|
+
if (!plugin)
|
|
150
|
+
return { content: [{ type: 'text', text: '❌ 索引器未启动' }] };
|
|
151
|
+
const db = plugin.db;
|
|
152
|
+
if (!db)
|
|
153
|
+
return { content: [{ type: 'text', text: '❌ 数据库未初始化' }] };
|
|
154
|
+
const timestamp = new Date().toISOString();
|
|
155
|
+
// 检查场景是否已存在
|
|
156
|
+
const existing = db.prepare(`
|
|
157
|
+
SELECT * FROM ai_scenarios WHERE scenario_id = ?
|
|
158
|
+
`).get(scenario_id);
|
|
159
|
+
if (existing) {
|
|
160
|
+
// 更新场景配置
|
|
161
|
+
db.prepare(`
|
|
162
|
+
UPDATE ai_scenarios SET
|
|
163
|
+
scenario_name = ?, scenario_type = ?, model_id = ?,
|
|
164
|
+
enabled = ?, auto_trigger = ?, trigger_conditions = ?,
|
|
165
|
+
prompt_template = ?, cost_bearer = ?, updated_at = ?
|
|
166
|
+
WHERE scenario_id = ?
|
|
167
|
+
`).run(scenario_name, scenario_type, model_id, enabled ? 1 : 0, auto_trigger ? 1 : 0, JSON.stringify(trigger_conditions || {}), prompt_template || '', cost_bearer, timestamp, scenario_id);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
// 创建新场景配置
|
|
171
|
+
db.prepare(`
|
|
172
|
+
INSERT INTO ai_scenarios (
|
|
173
|
+
scenario_id, scenario_name, scenario_type, model_id,
|
|
174
|
+
enabled, auto_trigger, trigger_conditions, prompt_template,
|
|
175
|
+
cost_bearer, created_at, updated_at
|
|
176
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
177
|
+
`).run(scenario_id, scenario_name, scenario_type, model_id, enabled ? 1 : 0, auto_trigger ? 1 : 0, JSON.stringify(trigger_conditions || {}), prompt_template || '', cost_bearer, timestamp, timestamp);
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
content: [{
|
|
181
|
+
type: 'text',
|
|
182
|
+
text: JSON.stringify({
|
|
183
|
+
success: true,
|
|
184
|
+
scenario_id: scenario_id,
|
|
185
|
+
scenario_name: scenario_name,
|
|
186
|
+
scenario_type: scenario_type,
|
|
187
|
+
model_id: model_id,
|
|
188
|
+
enabled: enabled,
|
|
189
|
+
auto_trigger: auto_trigger,
|
|
190
|
+
updated_at: timestamp,
|
|
191
|
+
message: 'AI 场景配置成功',
|
|
192
|
+
}, null, 2)
|
|
193
|
+
}]
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
catch (err) {
|
|
197
|
+
return { content: [{ type: 'text', text: `❌ ${err.message}` }] };
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
// Tool: 获取 AI 使用统计
|
|
201
|
+
server.tool('get_ai_usage_stats', '获取 AI 模型使用统计', {
|
|
202
|
+
model_id: zod_1.z.string().optional().describe('模型 ID(可选,不填则返回所有)'),
|
|
203
|
+
start_date: zod_1.z.string().optional().describe('开始日期'),
|
|
204
|
+
end_date: zod_1.z.string().optional().describe('结束日期'),
|
|
205
|
+
group_by: zod_1.z.enum(['day', 'week', 'month']).optional().describe('分组方式'),
|
|
206
|
+
}, async ({ model_id, start_date, end_date, group_by = 'day' }) => {
|
|
207
|
+
try {
|
|
208
|
+
const plugin = indexer?.getPlugin();
|
|
209
|
+
if (!plugin)
|
|
210
|
+
return { content: [{ type: 'text', text: '❌ 索引器未启动' }] };
|
|
211
|
+
const db = plugin.db;
|
|
212
|
+
if (!db)
|
|
213
|
+
return { content: [{ type: 'text', text: '❌ 数据库未初始化' }] };
|
|
214
|
+
// 构建查询
|
|
215
|
+
let sql = `
|
|
216
|
+
SELECT
|
|
217
|
+
model_id,
|
|
218
|
+
DATE(called_at) as date,
|
|
219
|
+
COUNT(*) as total_calls,
|
|
220
|
+
SUM(CASE WHEN action = 'generate_text' THEN 1 ELSE 0 END) as text_calls,
|
|
221
|
+
SUM(CASE WHEN action = 'generate_image' THEN 1 ELSE 0 END) as image_calls,
|
|
222
|
+
SUM(CASE WHEN action = 'translate' THEN 1 ELSE 0 END) as translation_calls
|
|
223
|
+
FROM ai_model_calls
|
|
224
|
+
WHERE 1=1
|
|
225
|
+
`;
|
|
226
|
+
const params = [];
|
|
227
|
+
if (model_id) {
|
|
228
|
+
sql += ` AND model_id = ?`;
|
|
229
|
+
params.push(model_id);
|
|
230
|
+
}
|
|
231
|
+
if (start_date) {
|
|
232
|
+
sql += ` AND called_at >= ?`;
|
|
233
|
+
params.push(start_date);
|
|
234
|
+
}
|
|
235
|
+
if (end_date) {
|
|
236
|
+
sql += ` AND called_at <= ?`;
|
|
237
|
+
params.push(end_date);
|
|
238
|
+
}
|
|
239
|
+
sql += ` GROUP BY model_id, DATE(called_at) ORDER BY date DESC`;
|
|
240
|
+
const stats = db.prepare(sql).all(...params);
|
|
241
|
+
return {
|
|
242
|
+
content: [{
|
|
243
|
+
type: 'text',
|
|
244
|
+
text: JSON.stringify({
|
|
245
|
+
model_id: model_id || 'all',
|
|
246
|
+
start_date: start_date || 'all',
|
|
247
|
+
end_date: end_date || 'all',
|
|
248
|
+
group_by: group_by,
|
|
249
|
+
stats: stats,
|
|
250
|
+
total_calls: stats.reduce((sum, s) => sum + s.total_calls, 0),
|
|
251
|
+
}, null, 2)
|
|
252
|
+
}]
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
catch (err) {
|
|
256
|
+
return { content: [{ type: 'text', text: `❌ ${err.message}` }] };
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
console.error('[MCP AI Tools] Registered 4 AI integration tools');
|
|
260
|
+
}
|
|
261
|
+
// Helper functions
|
|
262
|
+
function generateCallId() {
|
|
263
|
+
return 'CALL-' + Date.now().toString(36).toUpperCase() +
|
|
264
|
+
'-' + Math.random().toString(36).substring(2, 6).toUpperCase();
|
|
265
|
+
}
|
|
266
|
+
//# sourceMappingURL=ai-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-tools.js","sourceRoot":"","sources":["../../src/mcp/ai-tools.ts"],"names":[],"mappings":";AAAA,8CAA8C;AAC9C,cAAc;;AAId,0CAmTC;AArTD,6BAAwB;AAExB,SAAgB,eAAe,CAAC,MAAW,EAAE,OAAY;IAEvD,iBAAiB;IACjB,MAAM,CAAC,IAAI,CACT,oBAAoB,EACpB,YAAY,EACZ;QACE,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC;QACtC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC;QACv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B,SAAS,cAAc;IACrB,OAAO,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE;QAC/C,GAAG,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-dispatch-tools.d.ts","sourceRoot":"","sources":["../../src/mcp/auto-dispatch-tools.ts"],"names":[],"mappings":"AAKA,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,QAsXlE"}
|
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// TrustCoin MCP Server - Auto Dispatch Tools
|
|
3
|
+
// 自动派单机制工具
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.registerAutoDispatchTools = registerAutoDispatchTools;
|
|
6
|
+
const zod_1 = require("zod");
|
|
7
|
+
function registerAutoDispatchTools(server, indexer) {
|
|
8
|
+
// Tool: 订阅服务
|
|
9
|
+
server.tool('subscribe_service', '订阅服务提供者,接收订单通知并自动申请接单', {
|
|
10
|
+
subscriber_address: zod_1.z.string().describe('订阅者地址(骑手/司机)'),
|
|
11
|
+
target_address: zod_1.z.string().describe('被订阅者地址(卖家/服务点)'),
|
|
12
|
+
subscription_type: zod_1.z.enum(['delivery', 'taxi', 'housekeeping', 'repair', 'pickup']).describe('订阅类型'),
|
|
13
|
+
scope: zod_1.z.object({
|
|
14
|
+
max_distance: zod_1.z.number().optional().describe('最大距离(公里)'),
|
|
15
|
+
district: zod_1.z.string().optional().describe('区域范围'),
|
|
16
|
+
service_types: zod_1.z.array(zod_1.z.string()).optional().describe('服务类型'),
|
|
17
|
+
min_amount: zod_1.z.number().optional().describe('最小订单金额'),
|
|
18
|
+
max_amount: zod_1.z.number().optional().describe('最大订单金额'),
|
|
19
|
+
}).describe('订阅范围'),
|
|
20
|
+
conditions: zod_1.z.object({
|
|
21
|
+
auto_apply: zod_1.z.boolean().describe('是否自动申请接单'),
|
|
22
|
+
max_concurrent_orders: zod_1.z.number().describe('最大同时接单数'),
|
|
23
|
+
working_hours: zod_1.z.object({
|
|
24
|
+
start: zod_1.z.string(),
|
|
25
|
+
end: zod_1.z.string(),
|
|
26
|
+
}).describe('工作时间段'),
|
|
27
|
+
min_rating: zod_1.z.number().optional().describe('最低评分要求'),
|
|
28
|
+
min_deposit: zod_1.z.number().optional().describe('押金要求'),
|
|
29
|
+
}).describe('接单条件'),
|
|
30
|
+
}, async ({ subscriber_address, target_address, subscription_type, scope, conditions }) => {
|
|
31
|
+
try {
|
|
32
|
+
const plugin = indexer?.getPlugin();
|
|
33
|
+
if (!plugin)
|
|
34
|
+
return { content: [{ type: 'text', text: '❌ 索引器未启动' }] };
|
|
35
|
+
const db = plugin.db;
|
|
36
|
+
if (!db)
|
|
37
|
+
return { content: [{ type: 'text', text: '❌ 数据库未初始化' }] };
|
|
38
|
+
const subscriptionId = generateSubscriptionId();
|
|
39
|
+
const timestamp = new Date().toISOString();
|
|
40
|
+
// 创建订阅
|
|
41
|
+
db.prepare(`
|
|
42
|
+
INSERT INTO service_subscriptions (
|
|
43
|
+
subscription_id, subscriber_address, target_address, subscription_type,
|
|
44
|
+
scope, conditions, status, subscribed_at, last_active_at
|
|
45
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
46
|
+
`).run(subscriptionId, subscriber_address, target_address, subscription_type, JSON.stringify(scope), JSON.stringify(conditions), 'active', timestamp, timestamp);
|
|
47
|
+
return {
|
|
48
|
+
content: [{
|
|
49
|
+
type: 'text',
|
|
50
|
+
text: JSON.stringify({
|
|
51
|
+
success: true,
|
|
52
|
+
subscription_id: subscriptionId,
|
|
53
|
+
subscriber_address: subscriber_address,
|
|
54
|
+
target_address: target_address,
|
|
55
|
+
subscription_type: subscription_type,
|
|
56
|
+
status: 'active',
|
|
57
|
+
subscribed_at: timestamp,
|
|
58
|
+
message: '订阅成功',
|
|
59
|
+
}, null, 2)
|
|
60
|
+
}]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
return { content: [{ type: 'text', text: `❌ ${err.message}` }] };
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
// Tool: 自动申请接单
|
|
68
|
+
server.tool('auto_apply_order', '骑手/司机自动申请接单', {
|
|
69
|
+
order_id: zod_1.z.string().describe('订单 ID'),
|
|
70
|
+
applicant_address: zod_1.z.string().describe('申请人地址'),
|
|
71
|
+
estimated_arrival: zod_1.z.number().describe('预计到达时间(分钟)'),
|
|
72
|
+
distance: zod_1.z.number().describe('距离(公里)'),
|
|
73
|
+
message: zod_1.z.string().optional().describe('自我介绍'),
|
|
74
|
+
bid: zod_1.z.object({
|
|
75
|
+
delivery_fee: zod_1.z.number().describe('配送费'),
|
|
76
|
+
estimated_time: zod_1.z.number().describe('预计时间'),
|
|
77
|
+
}).optional().describe('报价'),
|
|
78
|
+
}, async ({ order_id, applicant_address, estimated_arrival, distance, message, bid }) => {
|
|
79
|
+
try {
|
|
80
|
+
const plugin = indexer?.getPlugin();
|
|
81
|
+
if (!plugin)
|
|
82
|
+
return { content: [{ type: 'text', text: '❌ 索引器未启动' }] };
|
|
83
|
+
const db = plugin.db;
|
|
84
|
+
if (!db)
|
|
85
|
+
return { content: [{ type: 'text', text: '❌ 数据库未初始化' }] };
|
|
86
|
+
// 获取申请人信息
|
|
87
|
+
const applicant = db.prepare(`
|
|
88
|
+
SELECT * FROM sellers WHERE address = ?
|
|
89
|
+
`).get(applicant_address);
|
|
90
|
+
if (!applicant) {
|
|
91
|
+
return { content: [{ type: 'text', text: '❌ 未找到申请人信息' }] };
|
|
92
|
+
}
|
|
93
|
+
// 计算优先级分数
|
|
94
|
+
const priorityScore = calculatePriority({
|
|
95
|
+
rating: applicant.reputation,
|
|
96
|
+
distance: distance,
|
|
97
|
+
estimatedArrival: estimated_arrival,
|
|
98
|
+
completedOrders: applicant.completed_orders,
|
|
99
|
+
onlineDuration: 0, // 需要从在线记录获取
|
|
100
|
+
});
|
|
101
|
+
const applicationId = generateApplicationId();
|
|
102
|
+
const timestamp = new Date().toISOString();
|
|
103
|
+
// 创建申请
|
|
104
|
+
db.prepare(`
|
|
105
|
+
INSERT INTO order_applications (
|
|
106
|
+
application_id, order_id, applicant_address, estimated_arrival,
|
|
107
|
+
distance, rating, completed_orders, message, bid, priority_score,
|
|
108
|
+
status, applied_at
|
|
109
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
|
110
|
+
`).run(applicationId, order_id, applicant_address, estimated_arrival, distance, applicant.reputation, applicant.completed_orders, message || '', JSON.stringify(bid || {}), priorityScore, 'pending', timestamp);
|
|
111
|
+
return {
|
|
112
|
+
content: [{
|
|
113
|
+
type: 'text',
|
|
114
|
+
text: JSON.stringify({
|
|
115
|
+
success: true,
|
|
116
|
+
application_id: applicationId,
|
|
117
|
+
order_id: order_id,
|
|
118
|
+
applicant_address: applicant_address,
|
|
119
|
+
priority_score: priorityScore,
|
|
120
|
+
estimated_arrival: estimated_arrival,
|
|
121
|
+
distance: distance,
|
|
122
|
+
status: 'pending',
|
|
123
|
+
applied_at: timestamp,
|
|
124
|
+
message: '申请接单成功',
|
|
125
|
+
}, null, 2)
|
|
126
|
+
}]
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
return { content: [{ type: 'text', text: `❌ ${err.message}` }] };
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
// Tool: 获取订单申请列表
|
|
134
|
+
server.tool('get_order_applications', '获取订单的申请列表(卖家/买家查看)', {
|
|
135
|
+
order_id: zod_1.z.string().describe('订单 ID'),
|
|
136
|
+
sort_by: zod_1.z.enum(['priority', 'distance', 'rating', 'arrival_time']).optional().describe('排序方式'),
|
|
137
|
+
limit: zod_1.z.number().optional().describe('返回数量'),
|
|
138
|
+
}, async ({ order_id, sort_by = 'priority', limit = 20 }) => {
|
|
139
|
+
try {
|
|
140
|
+
const plugin = indexer?.getPlugin();
|
|
141
|
+
if (!plugin)
|
|
142
|
+
return { content: [{ type: 'text', text: '❌ 索引器未启动' }] };
|
|
143
|
+
const db = plugin.db;
|
|
144
|
+
if (!db)
|
|
145
|
+
return { content: [{ type: 'text', text: '❌ 数据库未初始化' }] };
|
|
146
|
+
// 排序字段
|
|
147
|
+
const sortColumn = sort_by === 'priority' ? 'priority_score'
|
|
148
|
+
: sort_by === 'distance' ? 'distance'
|
|
149
|
+
: sort_by === 'rating' ? 'rating'
|
|
150
|
+
: 'estimated_arrival';
|
|
151
|
+
const applications = db.prepare(`
|
|
152
|
+
SELECT a.*, s.moniker as applicant_moniker
|
|
153
|
+
FROM order_applications a
|
|
154
|
+
LEFT JOIN sellers s ON a.applicant_address = s.address
|
|
155
|
+
WHERE a.order_id = ? AND a.status = 'pending'
|
|
156
|
+
ORDER BY ${sortColumn} DESC
|
|
157
|
+
LIMIT ?
|
|
158
|
+
`).all(order_id, limit);
|
|
159
|
+
return {
|
|
160
|
+
content: [{
|
|
161
|
+
type: 'text',
|
|
162
|
+
text: JSON.stringify({
|
|
163
|
+
order_id: order_id,
|
|
164
|
+
total: applications.length,
|
|
165
|
+
sort_by: sort_by,
|
|
166
|
+
applications: applications.map((a) => ({
|
|
167
|
+
application_id: a.application_id,
|
|
168
|
+
applicant_address: a.applicant_address,
|
|
169
|
+
applicant_moniker: a.applicant_moniker,
|
|
170
|
+
rating: a.rating,
|
|
171
|
+
distance: a.distance,
|
|
172
|
+
estimated_arrival: a.estimated_arrival,
|
|
173
|
+
priority_score: a.priority_score,
|
|
174
|
+
completed_orders: a.completed_orders,
|
|
175
|
+
message: a.message,
|
|
176
|
+
applied_at: a.applied_at,
|
|
177
|
+
})),
|
|
178
|
+
}, null, 2)
|
|
179
|
+
}]
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
return { content: [{ type: 'text', text: `❌ ${err.message}` }] };
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
// Tool: 派单决策
|
|
187
|
+
server.tool('dispatch_order', '选择申请人并派单', {
|
|
188
|
+
order_id: zod_1.z.string().describe('订单 ID'),
|
|
189
|
+
selected_applicant: zod_1.z.string().describe('选中的申请人地址'),
|
|
190
|
+
reason: zod_1.z.string().optional().describe('选择原因'),
|
|
191
|
+
}, async ({ order_id, selected_applicant, reason }) => {
|
|
192
|
+
try {
|
|
193
|
+
const plugin = indexer?.getPlugin();
|
|
194
|
+
if (!plugin)
|
|
195
|
+
return { content: [{ type: 'text', text: '❌ 索引器未启动' }] };
|
|
196
|
+
const db = plugin.db;
|
|
197
|
+
if (!db)
|
|
198
|
+
return { content: [{ type: 'text', text: '❌ 数据库未初始化' }] };
|
|
199
|
+
// 获取订单信息
|
|
200
|
+
const order = db.prepare(`
|
|
201
|
+
SELECT * FROM orders WHERE id = ?
|
|
202
|
+
`).get(order_id);
|
|
203
|
+
if (!order) {
|
|
204
|
+
return { content: [{ type: 'text', text: `❌ 未找到订单: ${order_id}` }] };
|
|
205
|
+
}
|
|
206
|
+
const timestamp = new Date().toISOString();
|
|
207
|
+
// 更新申请状态
|
|
208
|
+
db.prepare(`
|
|
209
|
+
UPDATE order_applications
|
|
210
|
+
SET status = 'accepted', accepted_at = ?
|
|
211
|
+
WHERE order_id = ? AND applicant_address = ?
|
|
212
|
+
`).run(timestamp, order_id, selected_applicant);
|
|
213
|
+
// 拒绝其他申请
|
|
214
|
+
db.prepare(`
|
|
215
|
+
UPDATE order_applications
|
|
216
|
+
SET status = 'rejected', rejected_at = ?
|
|
217
|
+
WHERE order_id = ? AND applicant_address != ? AND status = 'pending'
|
|
218
|
+
`).run(timestamp, order_id, selected_applicant);
|
|
219
|
+
// 更新订单状态
|
|
220
|
+
db.prepare(`
|
|
221
|
+
UPDATE orders
|
|
222
|
+
SET assigned_to = ?, status = 'assigned', assigned_at = ?
|
|
223
|
+
WHERE id = ?
|
|
224
|
+
`).run(selected_applicant, timestamp, order_id);
|
|
225
|
+
return {
|
|
226
|
+
content: [{
|
|
227
|
+
type: 'text',
|
|
228
|
+
text: JSON.stringify({
|
|
229
|
+
success: true,
|
|
230
|
+
order_id: order_id,
|
|
231
|
+
selected_applicant: selected_applicant,
|
|
232
|
+
reason: reason || '手动选择',
|
|
233
|
+
status: 'assigned',
|
|
234
|
+
assigned_at: timestamp,
|
|
235
|
+
message: '派单成功',
|
|
236
|
+
}, null, 2)
|
|
237
|
+
}]
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
catch (err) {
|
|
241
|
+
return { content: [{ type: 'text', text: `❌ ${err.message}` }] };
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
// Tool: 自动派单
|
|
245
|
+
server.tool('auto_dispatch', '根据规则自动派单', {
|
|
246
|
+
order_id: zod_1.z.string().describe('订单 ID'),
|
|
247
|
+
rule: zod_1.z.enum(['highest_priority', 'nearest', 'highest_rating', 'fastest_arrival', 'custom']).describe('派单规则'),
|
|
248
|
+
custom_rule: zod_1.z.string().optional().describe('自定义规则'),
|
|
249
|
+
}, async ({ order_id, rule, custom_rule }) => {
|
|
250
|
+
try {
|
|
251
|
+
const plugin = indexer?.getPlugin();
|
|
252
|
+
if (!plugin)
|
|
253
|
+
return { content: [{ type: 'text', text: '❌ 索引器未启动' }] };
|
|
254
|
+
const db = plugin.db;
|
|
255
|
+
if (!db)
|
|
256
|
+
return { content: [{ type: 'text', text: '❌ 数据库未初始化' }] };
|
|
257
|
+
// 获取申请列表
|
|
258
|
+
let sortColumn = 'priority_score';
|
|
259
|
+
if (rule === 'nearest')
|
|
260
|
+
sortColumn = 'distance';
|
|
261
|
+
if (rule === 'highest_rating')
|
|
262
|
+
sortColumn = 'rating';
|
|
263
|
+
if (rule === 'fastest_arrival')
|
|
264
|
+
sortColumn = 'estimated_arrival';
|
|
265
|
+
const applications = db.prepare(`
|
|
266
|
+
SELECT * FROM order_applications
|
|
267
|
+
WHERE order_id = ? AND status = 'pending'
|
|
268
|
+
ORDER BY ${sortColumn} DESC
|
|
269
|
+
LIMIT 1
|
|
270
|
+
`).all(order_id);
|
|
271
|
+
if (applications.length === 0) {
|
|
272
|
+
return { content: [{ type: 'text', text: '❌ 没有可用的申请' }] };
|
|
273
|
+
}
|
|
274
|
+
const selectedApplicant = applications[0].applicant_address;
|
|
275
|
+
const timestamp = new Date().toISOString();
|
|
276
|
+
// 自动派单
|
|
277
|
+
db.prepare(`
|
|
278
|
+
UPDATE order_applications
|
|
279
|
+
SET status = 'accepted', accepted_at = ?
|
|
280
|
+
WHERE order_id = ? AND applicant_address = ?
|
|
281
|
+
`).run(timestamp, order_id, selectedApplicant);
|
|
282
|
+
db.prepare(`
|
|
283
|
+
UPDATE order_applications
|
|
284
|
+
SET status = 'rejected', rejected_at = ?
|
|
285
|
+
WHERE order_id = ? AND applicant_address != ? AND status = 'pending'
|
|
286
|
+
`).run(timestamp, order_id, selectedApplicant);
|
|
287
|
+
db.prepare(`
|
|
288
|
+
UPDATE orders
|
|
289
|
+
SET assigned_to = ?, status = 'assigned', assigned_at = ?
|
|
290
|
+
WHERE id = ?
|
|
291
|
+
`).run(selectedApplicant, timestamp, order_id);
|
|
292
|
+
return {
|
|
293
|
+
content: [{
|
|
294
|
+
type: 'text',
|
|
295
|
+
text: JSON.stringify({
|
|
296
|
+
success: true,
|
|
297
|
+
order_id: order_id,
|
|
298
|
+
selected_applicant: selectedApplicant,
|
|
299
|
+
rule: rule,
|
|
300
|
+
priority_score: applications[0].priority_score,
|
|
301
|
+
status: 'assigned',
|
|
302
|
+
assigned_at: timestamp,
|
|
303
|
+
message: '自动派单成功',
|
|
304
|
+
}, null, 2)
|
|
305
|
+
}]
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
catch (err) {
|
|
309
|
+
return { content: [{ type: 'text', text: `❌ ${err.message}` }] };
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
console.error('[MCP Auto Dispatch Tools] Registered 5 auto dispatch tools');
|
|
313
|
+
}
|
|
314
|
+
// Helper functions
|
|
315
|
+
function generateSubscriptionId() {
|
|
316
|
+
return 'SUB-' + Date.now().toString(36).toUpperCase() +
|
|
317
|
+
'-' + Math.random().toString(36).substring(2, 6).toUpperCase();
|
|
318
|
+
}
|
|
319
|
+
function generateApplicationId() {
|
|
320
|
+
return 'APP-' + Date.now().toString(36).toUpperCase() +
|
|
321
|
+
'-' + Math.random().toString(36).substring(2, 6).toUpperCase();
|
|
322
|
+
}
|
|
323
|
+
function calculatePriority(params) {
|
|
324
|
+
const config = {
|
|
325
|
+
distanceWeight: 0.4,
|
|
326
|
+
ratingWeight: 0.3,
|
|
327
|
+
historyWeight: 0.15,
|
|
328
|
+
onlineWeight: 0.15,
|
|
329
|
+
};
|
|
330
|
+
let score = 0;
|
|
331
|
+
// 距离分数(距离越近分数越高)
|
|
332
|
+
const distanceScore = 100 - (params.distance * config.distanceWeight * 10);
|
|
333
|
+
score += distanceScore;
|
|
334
|
+
// 评分分数
|
|
335
|
+
const ratingScore = params.rating * config.ratingWeight * 20;
|
|
336
|
+
score += ratingScore;
|
|
337
|
+
// 历史接单数分数
|
|
338
|
+
const historyScore = Math.min(params.completedOrders / 100, 1) * config.historyWeight * 100;
|
|
339
|
+
score += historyScore;
|
|
340
|
+
// 在线时长分数
|
|
341
|
+
const onlineScore = Math.min(params.onlineDuration / 480, 1) * config.onlineWeight * 100;
|
|
342
|
+
score += onlineScore;
|
|
343
|
+
// 预计到达时间分数(越快分数越高)
|
|
344
|
+
const arrivalScore = 100 - (params.estimatedArrival * 2);
|
|
345
|
+
score += arrivalScore;
|
|
346
|
+
return Math.round(score);
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=auto-dispatch-tools.js.map
|