@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/telemetry/index.js
CHANGED
|
@@ -1,112 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { redactObject } from "./redact.js";
|
|
3
|
-
let _enabled = true;
|
|
4
|
-
export function setTelemetryEnabled(enabled) {
|
|
5
|
-
_enabled = enabled;
|
|
6
|
-
}
|
|
7
|
-
export function isTelemetryEnabled() {
|
|
8
|
-
return _enabled;
|
|
9
|
-
}
|
|
10
|
-
function extractFromOutput(structuredContent, toolName, operationTypeHint) {
|
|
11
|
-
if (!structuredContent) {
|
|
12
|
-
return { tool_name: toolName, semantic_hit: false };
|
|
13
|
-
}
|
|
14
|
-
const semantic = structuredContent.semantic;
|
|
15
|
-
const result = structuredContent.result;
|
|
16
|
-
const event = {
|
|
17
|
-
tool_name: toolName,
|
|
18
|
-
semantic_hit: !!semantic,
|
|
19
|
-
};
|
|
20
|
-
if (semantic) {
|
|
21
|
-
event.intent = semantic.intent;
|
|
22
|
-
event.status = semantic.status;
|
|
23
|
-
}
|
|
24
|
-
if (result?.type === "error") {
|
|
25
|
-
event.status = event.status || "failed";
|
|
26
|
-
event.error_code = result.error_code;
|
|
27
|
-
if (result.error) {
|
|
28
|
-
const truncated = String(result.error).slice(0, 500);
|
|
29
|
-
event.error_message = redactObject(truncated);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (operationTypeHint) {
|
|
33
|
-
event.operation_type = operationTypeHint;
|
|
34
|
-
}
|
|
35
|
-
else if (semantic?.intent) {
|
|
36
|
-
event.operation_type = "unknown";
|
|
37
|
-
}
|
|
38
|
-
return event;
|
|
39
|
-
}
|
|
40
|
-
export async function captureTelemetry(toolName, structuredContent, durationMs, operationTypeHint) {
|
|
41
|
-
if (!_enabled)
|
|
42
|
-
return;
|
|
43
|
-
try {
|
|
44
|
-
const extracted = extractFromOutput(structuredContent, toolName, operationTypeHint);
|
|
45
|
-
const event = {
|
|
46
|
-
timestamp: new Date().toISOString(),
|
|
47
|
-
tool_name: extracted.tool_name || toolName,
|
|
48
|
-
operation_type: extracted.operation_type || "unknown",
|
|
49
|
-
intent: extracted.intent,
|
|
50
|
-
status: extracted.status,
|
|
51
|
-
error_code: extracted.error_code,
|
|
52
|
-
duration_ms: durationMs,
|
|
53
|
-
semantic_hit: extracted.semantic_hit ?? false,
|
|
54
|
-
error_message: extracted.error_message,
|
|
55
|
-
};
|
|
56
|
-
await getStorage().append(event);
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
export async function captureTelemetryError(toolName, error, durationMs, operationTypeHint) {
|
|
62
|
-
if (!_enabled)
|
|
63
|
-
return;
|
|
64
|
-
try {
|
|
65
|
-
const errorMsg = String(error?.message ?? error).slice(0, 500);
|
|
66
|
-
const event = {
|
|
67
|
-
timestamp: new Date().toISOString(),
|
|
68
|
-
tool_name: toolName,
|
|
69
|
-
operation_type: operationTypeHint || "unknown",
|
|
70
|
-
status: "failed",
|
|
71
|
-
duration_ms: durationMs,
|
|
72
|
-
semantic_hit: false,
|
|
73
|
-
error_message: redactObject(errorMsg),
|
|
74
|
-
};
|
|
75
|
-
await getStorage().append(event);
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
export function withTelemetry(toolName, handler) {
|
|
81
|
-
return async (args) => {
|
|
82
|
-
const start = Date.now();
|
|
83
|
-
let output;
|
|
84
|
-
try {
|
|
85
|
-
output = await handler(args);
|
|
86
|
-
return output;
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
await captureTelemetryError(toolName, error, Date.now() - start, extractOperationType(args));
|
|
90
|
-
throw error;
|
|
91
|
-
}
|
|
92
|
-
finally {
|
|
93
|
-
if (output) {
|
|
94
|
-
await captureTelemetry(toolName, output?.structuredContent, Date.now() - start, extractOperationType(args));
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
function extractOperationType(args) {
|
|
100
|
-
if (!args || typeof args !== "object")
|
|
101
|
-
return undefined;
|
|
102
|
-
if (typeof args.operation_type === "string") {
|
|
103
|
-
if (args.operation_type.startsWith("cross_chain") || args.operation_type.startsWith("claim") ||
|
|
104
|
-
args.operation_type.startsWith("withdraw") || args.operation_type.startsWith("query_")) {
|
|
105
|
-
return "bridge_" + args.operation_type;
|
|
106
|
-
}
|
|
107
|
-
return args.operation_type;
|
|
108
|
-
}
|
|
109
|
-
if (args.data?.operation_type)
|
|
110
|
-
return args.data.operation_type;
|
|
111
|
-
return undefined;
|
|
112
|
-
}
|
|
1
|
+
import{getStorage}from'./storage.js';import{redactObject}from'./redact.js';let _enabled=!![];export function setTelemetryEnabled(a){_enabled=a;}export function isTelemetryEnabled(){return _enabled;}function extractFromOutput(a,b,c){if(!a)return{'tool_name':b,'semantic_hit':![]};const d=a['semantic'],e=a['result'],f={'tool_name':b,'semantic_hit':!!d};d&&(f['intent']=d['intent'],f['status']=d['status']);if(e?.['type']==='error'){f['status']=f['status']||'failed',f['error_code']=e['error_code'];if(e['error']){const g=String(e['error'])['slice'](0x0,0x1f4);f['error_message']=redactObject(g);}}if(c)f['operation_type']=c;else d?.['intent']&&(f['operation_type']='unknown');return f;}export async function captureTelemetry(a,b,c,d){if(!_enabled)return;try{const e=extractFromOutput(b,a,d),f={'timestamp':new Date()['toISOString'](),'tool_name':e['tool_name']||a,'operation_type':e['operation_type']||'unknown','intent':e['intent'],'status':e['status'],'error_code':e['error_code'],'duration_ms':c,'semantic_hit':e['semantic_hit']??![],'error_message':e['error_message']};await getStorage()['append'](f);}catch{}}export async function captureTelemetryError(a,b,c,d){if(!_enabled)return;try{const e=String(b?.['message']??b)['slice'](0x0,0x1f4),f={'timestamp':new Date()['toISOString'](),'tool_name':a,'operation_type':d||'unknown','status':'failed','duration_ms':c,'semantic_hit':![],'error_message':redactObject(e)};await getStorage()['append'](f);}catch{}}export function withTelemetry(a,b){return async c=>{const d=Date['now']();let e;try{return e=await b(c),e;}catch(f){await captureTelemetryError(a,f,Date['now']()-d,extractOperationType(c));throw f;}finally{e&&await captureTelemetry(a,e?.['structuredContent'],Date['now']()-d,extractOperationType(c));}};}function extractOperationType(a){if(!a||typeof a!=='object')return undefined;if(typeof a['operation_type']==='string'){if(a['operation_type']['startsWith']('cross_chain')||a['operation_type']['startsWith']('claim')||a['operation_type']['startsWith']('withdraw')||a['operation_type']['startsWith']('query_'))return'bridge_'+a['operation_type'];return a['operation_type'];}if(a['data']?.['operation_type'])return a['data']['operation_type'];return undefined;}
|
package/dist/telemetry/redact.js
CHANGED
|
@@ -1,23 +1 @@
|
|
|
1
|
-
import { createHash }
|
|
2
|
-
const ADDRESS_PATTERN = /^0x[0-9a-fA-F]{40,}$/;
|
|
3
|
-
export function redactAddress(value) {
|
|
4
|
-
if (typeof value !== "string")
|
|
5
|
-
return value;
|
|
6
|
-
if (!ADDRESS_PATTERN.test(value))
|
|
7
|
-
return value;
|
|
8
|
-
const hash = createHash("sha256").update(value.toLowerCase()).digest("hex");
|
|
9
|
-
return "0x" + hash.slice(0, 16);
|
|
10
|
-
}
|
|
11
|
-
export function redactObject(obj) {
|
|
12
|
-
if (typeof obj === "string")
|
|
13
|
-
return redactAddress(obj);
|
|
14
|
-
if (Array.isArray(obj))
|
|
15
|
-
return obj.map(redactObject);
|
|
16
|
-
if (obj && typeof obj === "object" && obj.constructor === Object) {
|
|
17
|
-
const out = {};
|
|
18
|
-
for (const k of Object.keys(obj))
|
|
19
|
-
out[k] = redactObject(obj[k]);
|
|
20
|
-
return out;
|
|
21
|
-
}
|
|
22
|
-
return obj;
|
|
23
|
-
}
|
|
1
|
+
import{createHash}from'crypto';const ADDRESS_PATTERN=/^0x[0-9a-fA-F]{40,}$/;export function redactAddress(a){if(typeof a!=='string')return a;if(!ADDRESS_PATTERN['test'](a))return a;const b=createHash('sha256')['update'](a['toLowerCase']())['digest']('hex');return'0x'+b['slice'](0x0,0x10);}export function redactObject(a){if(typeof a==='string')return redactAddress(a);if(Array['isArray'](a))return a['map'](redactObject);if(a&&typeof a==='object'&&a['constructor']===Object){const b={};for(const c of Object['keys'](a))b[c]=redactObject(a[c]);return b;}return a;}
|
|
@@ -1,80 +1 @@
|
|
|
1
|
-
import { mkdir, appendFile,
|
|
2
|
-
import { dirname, join } from "path";
|
|
3
|
-
import { getWowMcpDir } from "@wowok/wowok";
|
|
4
|
-
const MAX_SIZE_BYTES = 10 * 1024 * 1024;
|
|
5
|
-
const DATA_DIR = join(getWowMcpDir(), "data");
|
|
6
|
-
const TELEMETRY_FILE = join(DATA_DIR, "telemetry.jsonl");
|
|
7
|
-
const ROTATED_FILE = join(DATA_DIR, "telemetry.jsonl.1");
|
|
8
|
-
class JsonlStorage {
|
|
9
|
-
filePath;
|
|
10
|
-
rotatedPath;
|
|
11
|
-
writeQueue = Promise.resolve();
|
|
12
|
-
constructor(filePath = TELEMETRY_FILE, rotatedPath = ROTATED_FILE) {
|
|
13
|
-
this.filePath = filePath;
|
|
14
|
-
this.rotatedPath = rotatedPath;
|
|
15
|
-
}
|
|
16
|
-
async append(event) {
|
|
17
|
-
this.writeQueue = this.writeQueue.then(async () => {
|
|
18
|
-
try {
|
|
19
|
-
await mkdir(dirname(this.filePath), { recursive: true });
|
|
20
|
-
const line = JSON.stringify(event) + "\n";
|
|
21
|
-
await appendFile(this.filePath, line, "utf8");
|
|
22
|
-
await this.maybeRotate();
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
return this.writeQueue;
|
|
28
|
-
}
|
|
29
|
-
async query(filter) {
|
|
30
|
-
try {
|
|
31
|
-
const { readFile } = await import("fs/promises");
|
|
32
|
-
const content = await readFile(this.filePath, "utf8");
|
|
33
|
-
const lines = content.split("\n").filter((l) => l.trim());
|
|
34
|
-
const events = lines.map((l) => {
|
|
35
|
-
try {
|
|
36
|
-
return JSON.parse(l);
|
|
37
|
-
}
|
|
38
|
-
catch {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
}).filter((e) => e !== null);
|
|
42
|
-
return events.filter((e) => {
|
|
43
|
-
return Object.entries(filter).every(([k, v]) => e[k] === v);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
catch {
|
|
47
|
-
return [];
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async rotate() {
|
|
51
|
-
try {
|
|
52
|
-
await rename(this.filePath, this.rotatedPath).catch(() => { });
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
async maybeRotate() {
|
|
58
|
-
try {
|
|
59
|
-
const stats = await stat(this.filePath);
|
|
60
|
-
if (stats.size >= MAX_SIZE_BYTES) {
|
|
61
|
-
await this.rotate();
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
catch {
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
let _storage = null;
|
|
69
|
-
export function getStorage() {
|
|
70
|
-
if (!_storage) {
|
|
71
|
-
_storage = new JsonlStorage();
|
|
72
|
-
}
|
|
73
|
-
return _storage;
|
|
74
|
-
}
|
|
75
|
-
export function setStorage(storage) {
|
|
76
|
-
_storage = storage;
|
|
77
|
-
}
|
|
78
|
-
export function getTelemetryFilePath() {
|
|
79
|
-
return TELEMETRY_FILE;
|
|
80
|
-
}
|
|
1
|
+
import{mkdir,appendFile,stat,rename}from'fs/promises';import{dirname,join}from'path';import{getWowMcpDir}from'@wowok/wowok';const MAX_SIZE_BYTES=0xa*0x400*0x400,DATA_DIR=join(getWowMcpDir(),'data'),TELEMETRY_FILE=join(DATA_DIR,'telemetry.jsonl'),ROTATED_FILE=join(DATA_DIR,'telemetry.jsonl.1');class JsonlStorage{['filePath'];['rotatedPath'];['writeQueue']=Promise['resolve']();constructor(a=TELEMETRY_FILE,b=ROTATED_FILE){this['filePath']=a,this['rotatedPath']=b;}async['append'](a){return this['writeQueue']=this['writeQueue']['then'](async()=>{try{await mkdir(dirname(this['filePath']),{'recursive':!![]});const b=JSON['stringify'](a)+'\x0a';await appendFile(this['filePath'],b,'utf8'),await this['maybeRotate']();}catch{}}),this['writeQueue'];}async['query'](a){try{const {readFile:b}=await import('fs/promises'),c=await b(this['filePath'],'utf8'),d=c['split']('\x0a')['filter'](f=>f['trim']()),e=d['map'](f=>{try{return JSON['parse'](f);}catch{return null;}})['filter'](f=>f!==null);return e['filter'](f=>{return Object['entries'](a)['every'](([g,h])=>f[g]===h);});}catch{return[];}}async['rotate'](){try{await rename(this['filePath'],this['rotatedPath'])['catch'](()=>{});}catch{}}async['maybeRotate'](){try{const a=await stat(this['filePath']);a['size']>=MAX_SIZE_BYTES&&await this['rotate']();}catch{}}}let _storage=null;export function getStorage(){return!_storage&&(_storage=new JsonlStorage()),_storage;}export function setStorage(a){_storage=a;}export function getTelemetryFilePath(){return TELEMETRY_FILE;}
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import type { CallOutput } from "../../schema/call/base.js";
|
|
2
|
+
export declare function handleBridgeOperations(args: unknown): Promise<{
|
|
3
|
+
content: {
|
|
4
|
+
type: "text";
|
|
5
|
+
text: string;
|
|
6
|
+
}[];
|
|
7
|
+
structuredContent: CallOutput;
|
|
8
|
+
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{BridgeClient,LocalMark}from'@wowok/wowok';import{classifyError,buildSemantic,buildDataSemantic}from'../../schema/call/semantic.js';let _bridgeClient=null,_bridgeClientEnv=null;function getBridgeClient(a){const b=a||{},c=b?.['account'];return(_bridgeClient===null||_bridgeClientEnv===null||c!==_bridgeClientEnv?.['account'])&&(_bridgeClient=new BridgeClient({'wowEnv':b}),_bridgeClientEnv=b),_bridgeClient;}function getBridgeClientForQuery(){if(_bridgeClient!==null)return _bridgeClient;return _bridgeClient=new BridgeClient({}),_bridgeClientEnv={},_bridgeClient;}function validateMainnet(a){const b=a?.['network'];if(b&&b!=='mainnet')throw new Error('Bridge\x20only\x20supports\x20WOW\x20mainnet\x20(current\x20network:\x20\x27'+b+'\x27).\x20Only\x20mainnet\x20provides\x20cross-chain\x20functionality.');}async function resolveWowAddress(a,b){if(!a){const c=b?.['account'];return c;}if(/^0x[0-9a-fA-F]{64}$/['test'](a))return a;try{const d=await LocalMark['Instance']()['get_address'](a);if(d)return d;return a;}catch{return a;}}function safeJson(a){return JSON['stringify'](a,(b,c)=>typeof c==='bigint'?c['toString']():c,0x2);}function convertBigInts(a){if(typeof a==='bigint')return a['toString']();if(Array['isArray'](a))return a['map'](convertBigInts);if(a&&typeof a==='object'){const b={};for(const c of Object['keys'](a))b[c]=convertBigInts(a[c]);return b;}return a;}function ok(a,b,c){const d=convertBigInts(b),e=buildSemantic(d,c),f={'message':a,'result':{'type':'data','data':d},'semantic':e};return{'content':[{'type':'text','text':a},{'type':'text','text':safeJson(d)}],'structuredContent':f};}function err(a,b){const c=classifyError(a),d=buildDataSemantic(undefined,b,!![],a),e={'message':a,'result':{'type':'error','error':a,'error_code':c['error_code'],'retryable':c['retryable'],'recovery_hint':c['recovery_hint']},'semantic':d};return{'content':[{'type':'text','text':a}],'structuredContent':e};}export async function handleBridgeOperations(a){if(!a||typeof a!=='object')return err('Invalid\x20args:\x20expected\x20an\x20object\x20with\x20operation_type');let b;try{const {strictParse:f}=await import('../../schema/call/base.js');b=f((await import('../../schema/call/bridge.js'))['BridgeOperationsSchema'],a,'bridge_operations\x20input');}catch(g){return err('Parameter\x20validation\x20failed:\x20'+(g?.['message']??String(g)));}const c=b['env'],d={'operation_type':'bridge_'+b['operation_type'],'data':b['data']};try{switch(b['operation_type']){case'cross_chain_wow_to_evm':{validateMainnet(c);const h=b['data'],i=getBridgeClient(c),j=await i['bridgeWowToEvmSimple']({'token':h['token'],'amount':BigInt(h['amount']),'withdrawTo':h['withdrawTo'],'waitForFinalization':![],'idempotencyKey':h['idempotencyKey'],'idempotentByParams':h['idempotentByParams']}),k=j['idempotentHit']?'\x20[IDEMPOTENT\x20HIT\x20—\x20no\x20new\x20deposit]':'';return ok('WOW→EVM\x20cross-chain\x20step\x201\x20(deposit)\x20submitted.\x20transferId='+j['transferId']+',\x20activeEvmAccount='+j['activeEvmAccount']+'.'+k+'\x20'+'Next:\x20poll\x20query_transfer_status\x20until\x20bridge\x20signs\x20(~1-5\x20min),\x20then\x20call\x20claim_wow_to_evm\x20to\x20complete.',j,d);}case'cross_chain_evm_to_wow':{validateMainnet(c);const l=b['data'],m=await resolveWowAddress(l['recipientWowAddress'],c),n=getBridgeClient(c),o=await n['bridgeEvmToWowSimple']({'token':l['token'],'amount':BigInt(l['amount']),'recipientWowAddress':m,'waitForFinalization':![],'idempotencyKey':l['idempotencyKey'],'idempotentByParams':l['idempotentByParams']}),p=o['idempotentHit']?'\x20[IDEMPOTENT\x20HIT\x20—\x20no\x20new\x20deposit]':'';return ok('EVM→WOW\x20cross-chain\x20submitted.\x20transferId='+o['transferId']+',\x20activeEvmAccount='+o['activeEvmAccount']+'.'+p+'\x20'+'Bridge\x20will\x20auto-claim\x20on\x20WOW\x20(~10-20\x20min).\x20Poll\x20query_transfer_status\x20to\x20monitor\x20progress.',o,d);}case'claim_wow_to_evm':{validateMainnet(c);const q=b['data'],r=getBridgeClient(c),s=await r['claimWowToEvm'](q['transferId']);return ok('WOW→EVM\x20claim\x20(step\x202)\x20completed.\x20transferId='+s['transferId']+',\x20claimTxHash='+s['claimTxHash'],s,d);}case'resume_transfer':{validateMainnet(c);const t=b['data'],u=getBridgeClient(c),v=await u['resumeTransfer'](t['transferId']);return ok('Transfer\x20'+t['transferId']+'\x20resumed.\x20Current\x20step:\x20'+v['step']+',\x20status:\x20'+v['status']+'.',v,d);}case'withdraw':{const w=b['data'],x=getBridgeClientForQuery();let y=w['tokenAddress'];if(!y&&w['token']&&w['token']!=='ETH'){const A=x['config'],B=A?.['evmChains']?.['find'](D=>D['name']===(w['network']??'mainnet')),C=B?.['tokens']?.['find'](D=>D['symbol']===w['token']);y=C?.['evmAddress'];if(!y)return err('Cannot\x20resolve\x20ERC20\x20token\x20address\x20for\x20symbol\x20\x27'+w['token']+'\x27\x20on\x20chain\x20\x27'+(w['network']??'mainnet')+'\x27.\x20Please\x20pass\x20tokenAddress\x20explicitly.',d);}const z=await x['withdrawFromActiveEvmAccount']({'to':w['to'],'amount':BigInt(w['amount']),'tokenAddress':y,'token':w['token']?w['token']:undefined,'network':w['network']});return ok('Withdrawal\x20submitted.\x20transferId='+z['transferId']+',\x20txHash='+z['txHash'],z,d);}case'query_active_evm_account':{const D=b['data']??{},E=getBridgeClientForQuery(),F=await E['queryActiveEvmAccount']({'network':D['network'],'tokens':D['tokens']});return ok('activeEvmAccount:\x20'+F['address']+'\x20('+F['chains']['length']+'\x20chain(s))',F,d);}case'query_supported_evm_chains':{const G=getBridgeClientForQuery(),H=await G['querySupportedEvmChains']();return ok(H['length']+'\x20EVM\x20chain(s)\x20supported:\x20'+H['map'](I=>I['name']+'(chainId='+I['chainId']+')')['join'](',\x20'),H,d);}case'query_supported_tokens':{const I=b['data']??{},J=getBridgeClientForQuery(),K=await J['querySupportedTokens']({'network':I['network']}),L=K['reduce']((M,N)=>M+N['tokens']['length'],0x0);return ok(K['length']+'\x20chain(s),\x20'+L+'\x20token\x20entries:\x20'+K['map'](M=>M['chainName']+'('+M['tokens']['length']+'\x20tokens)')['join'](',\x20'),K,d);}case'query_transfer_list':{const M=b['data']??{},N=getBridgeClientForQuery();let O=await N['queryTransferList']({'onlyActive':M['onlyActive']});M['status']&&(O=O['filter'](Q=>Q['status']===M['status']));M['direction']&&(O=O['filter'](Q=>Q['direction']===M['direction']));M['token']&&(O=O['filter'](Q=>Q['token']===M['token']));M['limit']&&M['limit']>0x0&&(O=O['slice'](0x0,M['limit']));const P=O['filter'](Q=>Q['status']!=='success'&&Q['status']!=='failed')['length'];return ok(O['length']+'\x20transfer\x20record(s)\x20('+P+'\x20in\x20progress)'+(M['status']||M['direction']||M['token']?'\x20(filtered)':''),O,d);}case'query_transfer_status':{const Q=b['data'],R=getBridgeClientForQuery(),S=Q['refresh']!==![];if(S)try{await Promise['race']([R['refreshTransferStatus'](Q['transferId']),new Promise((U,V)=>setTimeout(()=>V(new Error('refresh\x20timeout')),0x3a98))]);}catch{}const T=await R['queryTransferStatus'](Q['transferId']);if(!T)return err('transferId\x20\x27'+Q['transferId']+'\x27\x20not\x20found.\x20'+'Use\x20query_transfer_list\x20to\x20see\x20all\x20valid\x20transferIds.\x20'+'Note:\x20transfer\x20history\x20is\x20persisted\x20in\x20cache.db\x20and\x20restored\x20on\x20MCP\x20restart,\x20'+'so\x20this\x20transferId\x20may\x20never\x20have\x20been\x20created\x20in\x20this\x20environment.',d);return ok('Transfer\x20'+Q['transferId']+':\x20'+T['direction']+'\x20/\x20'+T['step']+'\x20/\x20'+T['status'],T,d);}case'manage_evm_rpc':{const U=b['data'],V=getBridgeClientForQuery(),W=await V['manageEvmRpc']({'op':U['op'],'network':U['network'],'rpcUrls':U['rpcUrls']});return ok('RPC\x20\x27'+U['op']+'\x27\x20operation\x20'+(W['success']?'succeeded':'failed'),W,d);}default:{return err('Unsupported\x20operation_type:\x20'+b['operation_type'],d);}}}catch(X){const Y=X?.['message']??String(X);return err('Bridge\x20operation\x20failed:\x20'+Y,d);}}
|
|
@@ -1,74 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { strictParse } from "../../schema/index.js";
|
|
3
|
-
import { ConfigOperationInputSchema } from "../../schema/config/index.js";
|
|
4
|
-
export async function handleConfigOperation(args) {
|
|
5
|
-
const validated = strictParse(ConfigOperationInputSchema, args, "config_operation input");
|
|
6
|
-
const { action, service: serviceRaw } = validated;
|
|
7
|
-
let result;
|
|
8
|
-
switch (action) {
|
|
9
|
-
case "list":
|
|
10
|
-
result = { action: "list", services: listServices() };
|
|
11
|
-
break;
|
|
12
|
-
case "toggle": {
|
|
13
|
-
if (!serviceRaw)
|
|
14
|
-
throw new Error("'service' param is required for toggle");
|
|
15
|
-
const service = serviceRaw;
|
|
16
|
-
const existing = getServiceInfo(service);
|
|
17
|
-
if (!existing) {
|
|
18
|
-
throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
|
|
19
|
-
}
|
|
20
|
-
const newState = toggleService(service);
|
|
21
|
-
result = { action: "toggle", service, enabled: newState, reminder: existing.reminder };
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
case "enable": {
|
|
25
|
-
if (!serviceRaw)
|
|
26
|
-
throw new Error("'service' param is required for enable");
|
|
27
|
-
const service = serviceRaw;
|
|
28
|
-
const existing = getServiceInfo(service);
|
|
29
|
-
if (!existing)
|
|
30
|
-
throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
|
|
31
|
-
setServiceEnabled(service, true);
|
|
32
|
-
result = { action: "enable", service, enabled: true, reminder: existing.reminder };
|
|
33
|
-
break;
|
|
34
|
-
}
|
|
35
|
-
case "disable": {
|
|
36
|
-
if (!serviceRaw)
|
|
37
|
-
throw new Error("'service' param is required for disable");
|
|
38
|
-
const service = serviceRaw;
|
|
39
|
-
const existing = getServiceInfo(service);
|
|
40
|
-
if (!existing)
|
|
41
|
-
throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
|
|
42
|
-
setServiceEnabled(service, false);
|
|
43
|
-
result = { action: "disable", service, enabled: false, reminder: existing.reminder };
|
|
44
|
-
break;
|
|
45
|
-
}
|
|
46
|
-
case "reset": {
|
|
47
|
-
if (!serviceRaw)
|
|
48
|
-
throw new Error("'service' param is required for reset");
|
|
49
|
-
const service = serviceRaw;
|
|
50
|
-
const existing = getServiceInfo(service);
|
|
51
|
-
if (!existing)
|
|
52
|
-
throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
|
|
53
|
-
resetService(service);
|
|
54
|
-
result = { action: "reset", service, enabled: getServiceInfo(service)?.enabled, reminder: existing.reminder, reset: true };
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
case "info": {
|
|
58
|
-
if (!serviceRaw)
|
|
59
|
-
throw new Error("'service' param is required for info");
|
|
60
|
-
const service = serviceRaw;
|
|
61
|
-
const info = getServiceInfo(service);
|
|
62
|
-
if (!info)
|
|
63
|
-
throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
|
|
64
|
-
result = { action: "info", ...info };
|
|
65
|
-
break;
|
|
66
|
-
}
|
|
67
|
-
default:
|
|
68
|
-
throw new Error(`Unknown config_operation action: ${String(action)}`);
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
content: [{ type: "text", text: JSON.stringify({ result }) }],
|
|
72
|
-
structuredContent: { result },
|
|
73
|
-
};
|
|
74
|
-
}
|
|
1
|
+
import{listServices,getServiceInfo,toggle as a350a,setEnabled as a350b,reset as a350c}from'../../config/index.js';import{strictParse}from'../../schema/index.js';import{ConfigOperationInputSchema}from'../../schema/config/index.js';export async function handleConfigOperation(a){const b=strictParse(ConfigOperationInputSchema,a,'config_operation\x20input'),{action:c,service:d}=b;let e;switch(c){case'list':e={'action':'list','services':listServices()};break;case'toggle':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20toggle');const f=d,g=getServiceInfo(f);if(!g)throw new Error('Unknown\x20service:\x20'+f+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');const h=a350a(f);e={'action':'toggle','service':f,'enabled':h,'reminder':g['reminder']};break;}case'enable':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20enable');const i=d,j=getServiceInfo(i);if(!j)throw new Error('Unknown\x20service:\x20'+i+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');a350b(i,!![]),e={'action':'enable','service':i,'enabled':!![],'reminder':j['reminder']};break;}case'disable':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20disable');const k=d,l=getServiceInfo(k);if(!l)throw new Error('Unknown\x20service:\x20'+k+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');a350b(k,![]),e={'action':'disable','service':k,'enabled':![],'reminder':l['reminder']};break;}case'reset':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20reset');const m=d,n=getServiceInfo(m);if(!n)throw new Error('Unknown\x20service:\x20'+m+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');a350c(m),e={'action':'reset','service':m,'enabled':getServiceInfo(m)?.['enabled'],'reminder':n['reminder'],'reset':!![]};break;}case'info':{if(!d)throw new Error('\x27service\x27\x20param\x20is\x20required\x20for\x20info');const o=d,p=getServiceInfo(o);if(!p)throw new Error('Unknown\x20service:\x20'+o+'.\x20Use\x20action=\x27list\x27\x20to\x20see\x20all\x20valid\x20services.');e={'action':'info',...p};break;}default:throw new Error('Unknown\x20config_operation\x20action:\x20'+String(c));}return{'content':[{'type':'text','text':JSON['stringify']({'result':e})}],'structuredContent':{'result':e}};}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{strictParse}from'../../schema/index.js';import{EmployeeOperationInputSchema}from'../../schema/employee/index.js';import{getEmployeeStore}from'../../participation/employee-store.js';import{assessReactionKpi,resolveLiability}from'../../participation/employee-kpi.js';export async function handleEmployeeOperation(a){const b=strictParse(EmployeeOperationInputSchema,a,'employee_operation\x20input'),c=getEmployeeStore();let d;switch(b['action']){case'set':{await c['save'](b['account'],b['profile']),d={'action':'set','account':b['account'],'profile':b['profile']};break;}case'get':{d={'action':'get','account':b['account'],'profile':await c['get'](b['account'])};break;}case'remove':{d={'action':'remove','account':b['account'],'removed':await c['remove'](b['account'])};break;}case'assess_kpi':{let e=b['budget_ms'];if(e===undefined&&b['account']){const f=await c['get'](b['account']);e=f?.['response_time_budget_ms'];}d={'action':'assess_kpi',...assessReactionKpi(b['node'],b['assigned_at'],b['advanced_at'],e)};break;}case'resolve_liability':{let g=b['liability'];if(g===undefined&&b['account']){const h=await c['get'](b['account']);g=h?.['liability'];}if(g===undefined)throw new Error('resolve_liability\x20requires\x20`account`\x20(with\x20a\x20stored\x20profile)\x20or\x20an\x20explicit\x20`liability`');d={'action':'resolve_liability',...resolveLiability(g,b['loss_amount'],b['hybrid_threshold']??0x0)};break;}default:throw new Error('Unknown\x20employee_operation\x20action');}return{'content':[{'type':'text','text':JSON['stringify']({'result':d})}],'structuredContent':{'result':d}};}
|
|
@@ -1,123 +1 @@
|
|
|
1
|
-
import { strictParse } from "../../schema/index.js";
|
|
2
|
-
import { EvaluationOperationInputSchema } from "../../schema/evaluation/index.js";
|
|
3
|
-
import { evaluateArbGame } from "../../evaluation/arbitration-game.js";
|
|
4
|
-
import { evaluateNodeGame } from "../../evaluation/node-game.js";
|
|
5
|
-
import { summarizeCapabilityGaps } from "../../evaluation/gap.js";
|
|
6
|
-
import { composeServicesForDemand } from "../../evaluation/composer.js";
|
|
7
|
-
import { matchDemandToServices, matchServiceToDemands } from "../../evaluation/builtins/demand-match.js";
|
|
8
|
-
import { assessServiceRisk } from "../../evaluation/builtins/service-risk.js";
|
|
9
|
-
import { registerBuiltinEvaluations } from "../../evaluation/builtins/index.js";
|
|
10
|
-
import { getEffectivePersona, mergeInjections, personaToInjection } from "../../persona/index.js";
|
|
11
|
-
registerBuiltinEvaluations();
|
|
12
|
-
function capabilityFromInput(input) {
|
|
13
|
-
return {
|
|
14
|
-
id: input.id,
|
|
15
|
-
kind: input.kind,
|
|
16
|
-
owner: input.owner ?? "",
|
|
17
|
-
industry: input.industry,
|
|
18
|
-
industry_confidence: input.industry_confidence ?? 0,
|
|
19
|
-
region: input.region,
|
|
20
|
-
price_min: input.price_min !== undefined ? BigInt(input.price_min) : undefined,
|
|
21
|
-
price_max: input.price_max !== undefined ? BigInt(input.price_max) : undefined,
|
|
22
|
-
token_type: input.token_type ?? "",
|
|
23
|
-
ticket_size: input.ticket_size ?? "medium",
|
|
24
|
-
trust_score: input.trust_score ?? 50,
|
|
25
|
-
reputation_like_ratio: input.reputation_like_ratio ?? 1,
|
|
26
|
-
arbitration_independent: input.arbitration_independent ?? false,
|
|
27
|
-
merchant_history_count: input.merchant_history_count ?? 0,
|
|
28
|
-
capabilities: input.capabilities,
|
|
29
|
-
tags: input.tags ?? [],
|
|
30
|
-
keywords: input.keywords ?? [],
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
function puzzleRawFromInput(input) {
|
|
34
|
-
return {
|
|
35
|
-
service: {
|
|
36
|
-
...input.service,
|
|
37
|
-
priceRaw: input.service.priceRaw !== undefined ? BigInt(input.service.priceRaw) : undefined,
|
|
38
|
-
compensation_fund: input.service.compensation_fund
|
|
39
|
-
? { balance: input.service.compensation_fund.balance !== undefined ? BigInt(input.service.compensation_fund.balance) : undefined }
|
|
40
|
-
: undefined,
|
|
41
|
-
},
|
|
42
|
-
machine_nodes: input.machine_nodes,
|
|
43
|
-
machine_published: input.machine_published,
|
|
44
|
-
machine_paused: input.machine_paused,
|
|
45
|
-
reviews: input.reviews,
|
|
46
|
-
events: input.events,
|
|
47
|
-
similar_services: input.similar_services?.map((s) => ({ price: BigInt(s.price) })),
|
|
48
|
-
order_amount: input.order_amount !== undefined ? BigInt(input.order_amount) : undefined,
|
|
49
|
-
trust_score: input.trust_score,
|
|
50
|
-
arbitration_owner: input.arbitration_owner,
|
|
51
|
-
service_owner: input.service_owner,
|
|
52
|
-
wip_verified: input.wip_verified,
|
|
53
|
-
order_history: input.order_history,
|
|
54
|
-
merchant_reputation: input.merchant_reputation,
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
async function resolveInjection(account, explicit) {
|
|
58
|
-
const base = account ? personaToInjection(await getEffectivePersona(account)) : undefined;
|
|
59
|
-
return mergeInjections(base, explicit);
|
|
60
|
-
}
|
|
61
|
-
export async function handleEvaluationOperation(args) {
|
|
62
|
-
const validated = strictParse(EvaluationOperationInputSchema, args, "evaluation_operation input");
|
|
63
|
-
let result;
|
|
64
|
-
switch (validated.action) {
|
|
65
|
-
case "arb_game": {
|
|
66
|
-
result = { action: "arb_game", ...evaluateArbGame(validated.status, validated.perspective) };
|
|
67
|
-
break;
|
|
68
|
-
}
|
|
69
|
-
case "node_game": {
|
|
70
|
-
result = {
|
|
71
|
-
action: "node_game",
|
|
72
|
-
...evaluateNodeGame({
|
|
73
|
-
current_node: validated.current_node,
|
|
74
|
-
perspective: validated.perspective,
|
|
75
|
-
operable: validated.operable,
|
|
76
|
-
waiting_on: validated.waiting_on ?? [],
|
|
77
|
-
}),
|
|
78
|
-
};
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
case "capability_gap": {
|
|
82
|
-
result = {
|
|
83
|
-
action: "capability_gap",
|
|
84
|
-
report: summarizeCapabilityGaps(capabilityFromInput(validated.demand), capabilityFromInput(validated.service)),
|
|
85
|
-
};
|
|
86
|
-
break;
|
|
87
|
-
}
|
|
88
|
-
case "compose_service": {
|
|
89
|
-
result = {
|
|
90
|
-
action: "compose_service",
|
|
91
|
-
plan: composeServicesForDemand(capabilityFromInput(validated.demand), validated.services.map(capabilityFromInput)),
|
|
92
|
-
};
|
|
93
|
-
break;
|
|
94
|
-
}
|
|
95
|
-
case "demand_match": {
|
|
96
|
-
result = {
|
|
97
|
-
action: "demand_match",
|
|
98
|
-
matches: await matchDemandToServices(capabilityFromInput(validated.demand_cap), validated.services, await resolveInjection(validated.account, validated.injection)),
|
|
99
|
-
};
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
case "service_match": {
|
|
103
|
-
result = {
|
|
104
|
-
action: "service_match",
|
|
105
|
-
matches: await matchServiceToDemands(capabilityFromInput(validated.service_cap), validated.demands, await resolveInjection(validated.account, validated.injection)),
|
|
106
|
-
};
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
case "service_risk": {
|
|
110
|
-
result = {
|
|
111
|
-
action: "service_risk",
|
|
112
|
-
result: await assessServiceRisk(validated.service_id, puzzleRawFromInput(validated.puzzle_raw), await resolveInjection(validated.account, validated.injection), validated.depth ?? "preorder"),
|
|
113
|
-
};
|
|
114
|
-
break;
|
|
115
|
-
}
|
|
116
|
-
default:
|
|
117
|
-
throw new Error("Unknown evaluation_operation action");
|
|
118
|
-
}
|
|
119
|
-
return {
|
|
120
|
-
content: [{ type: "text", text: JSON.stringify({ result }) }],
|
|
121
|
-
structuredContent: { result },
|
|
122
|
-
};
|
|
123
|
-
}
|
|
1
|
+
import{strictParse}from'../../schema/index.js';import{EvaluationOperationInputSchema}from'../../schema/evaluation/index.js';import{evaluateArbGame}from'../../evaluation/arbitration-game.js';import{evaluateNodeGame}from'../../evaluation/node-game.js';import{evaluatePathReasoning}from'../../evaluation/path-reasoning.js';import{assessEvidenceReview}from'../../knowledge/evidence-review.js';import{expandSearchScope,inferSensitivity,rankByLocation}from'../../evaluation/location-match.js';import{query_services,query_arbs,query_demands,query_objects,queryTableItem_EntityLinker,ArbStatus}from'@wowok/wowok';import{summarizeCapabilityGaps}from'../../evaluation/gap.js';import{composeServicesForDemand}from'../../evaluation/composer.js';import{matchDemandToServices,matchServiceToDemands}from'../../evaluation/builtins/demand-match.js';import{extractDemandCapability}from'../../evaluation/extract.js';import{assessServiceRisk}from'../../evaluation/builtins/service-risk.js';import{assessArbitration}from'../../evaluation/builtins/arbitration-score.js';import{resolveCategoryMatchRules,toSoftWeightInjection,applyHardConstraints}from'../../evaluation/category-match-rules.js';import{computeMarketMetrics}from'../../knowledge/market-metrics.js';import{assessAntiCheat}from'../../knowledge/anti-cheat.js';import{computeJourneyFunnel,attributeReferrals,buildCustomerRelationships}from'../../knowledge/market-operations.js';import{suggestPricing}from'../../knowledge/dynamic-pricing.js';import{runAccountEventWatchers}from'../../customer/account-events.js';import{registerBuiltinEvaluations}from'../../evaluation/builtins/index.js';import{getEffectivePersona,mergeInjections,personaToInjection}from'../../persona/index.js';registerBuiltinEvaluations();function arbCaseFromObject(b){const c=typeof b['time']==='number'?b['time']:Number(b['time']??0x0);return{'status':b['status'],'time':Number['isFinite'](c)?c:undefined,'resolved_time':typeof b['indemnity']?.['time']==='number'?b['indemnity']['time']:b['compensation_time']??undefined,'indemnity_amount':b['indemnity']?.['amount'],'objected':b['status']===ArbStatus['Objectionable']||b['objection']!=null&&b['objection']['length']>0x0};}async function arbCasesWithRoles(a,b){const c=a['map'](arbCaseFromObject),d=Array['from'](new Set(a['map'](j=>j['order'])['filter'](Boolean))),e=new Map(),f=[];if(d['length']>0x0){const j=await query_objects({'objects':d,'network':b});for(const k of j['objects']??[]){const l=k;if(!l?.['object'])continue;e['set'](l['object'],l);if(l['service'])f['push'](l['service']);}}const g=new Map(),h=Array['from'](new Set(f));if(h['length']>0x0){const m=await query_objects({'objects':h,'network':b});for(const n of m['objects']??[]){const p=n;if(p?.['object'])g['set'](p['object'],p);}}for(let q=0x0;q<a['length'];q++){const r=e['get'](a[q]['order']);if(!r)continue;c[q]['customer']=r['builder']||undefined;const t=g['get'](r['service']);if(t)c[q]['merchant']=t['permission']||undefined;}return c;}function capabilityFromInput(a){return{'id':a['id'],'kind':a['kind'],'owner':a['owner']??'','industry':a['industry'],'industry_confidence':a['industry_confidence']??0x0,'region':a['region'],'price_min':a['price_min']!==undefined?BigInt(a['price_min']):undefined,'price_max':a['price_max']!==undefined?BigInt(a['price_max']):undefined,'token_type':a['token_type']??'','ticket_size':a['ticket_size']??'medium','trust_score':a['trust_score']??0x32,'reputation_like_ratio':a['reputation_like_ratio']??0x1,'arbitration_independent':a['arbitration_independent']??![],'merchant_history_count':a['merchant_history_count']??0x0,'capabilities':a['capabilities'],'tags':a['tags']??[],'keywords':a['keywords']??[]};}function puzzleRawFromInput(a){return{'service':{...a['service'],'priceRaw':a['service']['priceRaw']!==undefined?BigInt(a['service']['priceRaw']):undefined,'compensation_fund':a['service']['compensation_fund']?{'balance':a['service']['compensation_fund']['balance']!==undefined?BigInt(a['service']['compensation_fund']['balance']):undefined}:undefined},'machine_nodes':a['machine_nodes'],'machine_published':a['machine_published'],'machine_paused':a['machine_paused'],'reviews':a['reviews'],'events':a['events'],'similar_services':a['similar_services']?.['map'](b=>({'price':BigInt(b['price'])})),'order_amount':a['order_amount']!==undefined?BigInt(a['order_amount']):undefined,'trust_score':a['trust_score'],'arbitration_owner':a['arbitration_owner'],'service_owner':a['service_owner'],'wip_verified':a['wip_verified'],'order_history':a['order_history'],'merchant_reputation':a['merchant_reputation']};}async function resolveInjection(a,b){const c=a?personaToInjection(await getEffectivePersona(a)):undefined;return mergeInjections(c,b);}function serviceSummaryToExtract(a){const b=a['json']??{},c=f=>typeof f==='string'?f:undefined,d=f=>typeof f==='string'?f:null,e=Array['isArray'](b['sales'])?b['sales']['map'](f=>({'name':typeof f?.['name']==='string'?f['name']:undefined,'price':typeof f?.['price']==='string'?f['price']:f?.['price']!=null?String(f['price']):'0','wip_hash':typeof f?.['wip_hash']==='string'?f['wip_hash']:undefined})):[];return{'object':a['object'],'description':c(b['description'])??'','location':a['location']??c(b['location'])??'','sales':e,'arbitrations':Array['isArray'](b['arbitrations'])?b['arbitrations']['map'](String):[],'compensation_fund':c(b['compensation_fund']),'buy_guard':d(b['buy_guard']),'machine':d(b['machine']),'um':d(b['um']),'bPublished':b['bPublished']===!![],'bPaused':b['bPaused']===!![]};}export async function handleEvaluationOperation(a){const b=strictParse(EvaluationOperationInputSchema,a,'evaluation_operation\x20input');let c;switch(b['action']){case'arb_game':{const e=b['account']?await getEffectivePersona(b['account']):null,f=b['appetite']??e?.['layer']['preferences']?.['risk_appetite'],g=b['requirements']??e?.['layer']['requirements'];c={'action':'arb_game',...evaluateArbGame(b['status'],b['perspective'],{'risk_appetite':f,'requirements':g})};break;}case'node_game':{const h=b['account']?await getEffectivePersona(b['account']):null,i=b['appetite']??h?.['layer']['preferences']?.['risk_appetite'],j=b['requirements']??h?.['layer']['requirements'];c={'action':'node_game',...evaluateNodeGame({'current_node':b['current_node'],'perspective':b['perspective'],'appetite':i,'requirements':j,'threshold':b['threshold'],'allocation':b['allocation'],'order_amount':b['order_amount'],'compensation_fund':b['compensation_fund'],'operable':b['operable'],'waiting_on':b['waiting_on']??[]})};break;}case'capability_gap':{c={'action':'capability_gap','report':summarizeCapabilityGaps(capabilityFromInput(b['demand']),capabilityFromInput(b['service']))};break;}case'compose_service':{c={'action':'compose_service','plan':composeServicesForDemand(capabilityFromInput(b['demand']),b['services']['map'](capabilityFromInput))};break;}case'demand_match':{c={'action':'demand_match','matches':await matchDemandToServices(capabilityFromInput(b['demand_cap']),b['services'],await resolveInjection(b['account'],b['injection']))};break;}case'service_match':{c={'action':'service_match','matches':await matchServiceToDemands(capabilityFromInput(b['service_cap']),b['demands'],await resolveInjection(b['account'],b['injection']))};break;}case'service_risk':{c={'action':'service_risk','result':await assessServiceRisk(b['service_id'],puzzleRawFromInput(b['puzzle_raw']),await resolveInjection(b['account'],b['injection']),b['depth']??'preorder')};break;}case'path_reasoning':{const k=b['account']?await getEffectivePersona(b['account']):null,l=b['appetite']??k?.['layer']['preferences']?.['risk_appetite'],m=b['requirements']??k?.['layer']['requirements'];c={'action':'path_reasoning',...evaluatePathReasoning({'current_node':b['current_node'],'perspective':b['perspective'],'machine_nodes':b['machine_nodes'],'node_annotations':b['node_annotations'],'appetite':l,'requirements':m,'order_amount':b['order_amount'],'max_depth':b['max_depth']})};break;}case'evidence_review':{c={'action':'evidence_review','review':assessEvidenceReview({'kind':b['kind'],'hash_committed':b['hash_committed'],'digital_check_passed':b['digital_check_passed'],'contradiction':b['contradiction']})};break;}case'discover_services':{const n=!b['sensitivity']?inferSensitivity(b['description']??''):null,o=b['sensitivity']??n['sensitivity'],p=n?.['signals']??[],q=b['context_network']??'testnet',r={'raw':b['location'],...b['region']??{}},s=expandSearchScope(o,r),t=await query_services({'coin_type':b['coin_type'],'name_contains':b['name_contains'],'location_any':s['search_terms'],'max_objects':b['max_objects'],'network':q,'no_cache':b['no_cache']}),u=rankByLocation(o,r,t['services']['map'](v=>({'id':v['object'],'name':v['name'],'location':v['location']})));c={'action':'discover_services','sensitivity':o,'inference_signals':p,'services':u['map'](v=>{const w=t['services']['find'](x=>x['object']===v['id']);return{'object':v['id'],'name':w?.['name'],'location':w?.['location'],'relation':v['relation'],'satisfied':v['satisfied'],'score':v['score'],'reason':v['reason']};}),'total_enumerated':t['total_enumerated'],'has_more':t['has_more'],'scope_advice':{'search_terms':s['search_terms'],'ai_enrichment_note':s['ai_enrichment_note']}};break;}case'discover_demands':{const v=b['context_network']??'testnet',w=await query_demands({'max_objects':b['max_objects'],'network':v,'no_cache':b['no_cache']}),x=b['location']?.['toLowerCase'](),y=w['demands']['filter'](z=>!x||(z['location']??'')['toLowerCase']()['includes'](x))['map'](z=>({'object':z['object'],'description':z['description']??'','location':z['location']??'','presenters_count':z['presenters_count']??0x0,'permission':z['permission']??''}));c={'action':'discover_demands','demands':y,'total_enumerated':w['total_enumerated'],'has_more':w['has_more']};break;}case'market_metrics':{const z=b['context_network']??'testnet',A=await computeMarketMetrics(z,b['no_cache']);c={'action':'market_metrics',...A};break;}case'anti_cheat':{const B=assessAntiCheat({'service':{'object':b['service']['object'],'arbitrations':b['service']['arbitrations'],'compensation_fund':b['service']['compensation_fund'],'machine':b['service']['machine'],'bPublished':b['service']['bPublished']},'orders':b['orders'],'reviews':b['reviews']});c={'action':'anti_cheat','signals':B};break;}case'market_operations':{if(b['op']==='journey_funnel')c={'action':'market_operations','result':computeJourneyFunnel({'due_diligence':b['due_diligence']??0x0,'orders':b['orders']??0x0,'completed':b['completed']??0x0,'reviews':b['reviews']??0x0})};else{if(b['op']==='referral_attribution')c={'action':'market_operations','result':attributeReferrals(b['referral_orders']??[])};else{if(b['op']==='dynamic_pricing'){const C=b['market_signals'];if(!C)throw new Error('dynamic_pricing\x20op\x20requires\x20market_signals');c={'action':'market_operations','result':suggestPricing({'supplyCount':C['supplyCount'],'demandCount':C['demandCount'],'avgPrice':C['avgPrice'],'myPrice':C['myPrice'],'competitorPrices':C['competitorPrices'],'recentOrderCount':C['recentOrderCount'],'repeatCustomerRate':C['repeatCustomerRate']})};}else c={'action':'market_operations','result':buildCustomerRelationships(b['customer_orders']??[])};}}break;}case'match_discover':{const D=!b['sensitivity']?inferSensitivity(b['description']??''):null,E=b['sensitivity']??D['sensitivity'],F=D?.['signals']??[],G=b['context_network']??'testnet',H={'raw':b['location'],...b['region']??{}},I=expandSearchScope(E,H),J=await query_services({'coin_type':b['coin_type'],'name_contains':b['name_contains'],'location_any':I['search_terms'],'max_objects':b['max_objects'],'network':G,'no_cache':b['no_cache']}),K=new Set(b['required_capabilities']??[]),L=extractDemandCapability({'object':'intent','description':b['description'],'location':b['location'],'owner':b['account']},{'price_max':b['budget']!==undefined?BigInt(b['budget']):undefined,'capabilities':{'has_arbitration':K['has']('has_arbitration'),'has_refund_path':K['has']('has_refund_path'),'has_milestone_nodes':K['has']('has_milestone_nodes'),'has_compensation_fund':K['has']('has_compensation_fund'),'has_wip_verification':K['has']('has_wip_verification'),'has_messenger':K['has']('has_messenger'),'has_buy_guard':K['has']('has_buy_guard'),'has_dynamic_pricing':K['has']('has_dynamic_pricing'),'is_published':!![],'is_paused':![]}}),M=rankByLocation(E,H,J['services']['map'](X=>({'id':X['object'],'name':X['name'],'location':X['location']}))),N=M['filter'](X=>X['satisfied']),O=J['services']['filter'](X=>N['some'](Y=>Y['id']===X['object']))['map'](serviceSummaryToExtract),P=resolveCategoryMatchRules(b['category']);let Q=O;const R=[];if(P){const X=applyHardConstraints(P,O);Q=X['passed'];for(const Y of X['dropped']){R['push']({'object':Y['candidate']['object'],'reason':Y['constraint']['description']});}}let S=await resolveInjection(b['account'],b['injection']);P&&(S=mergeInjections(S,toSoftWeightInjection(P)));const T=await matchDemandToServices(L,Q,S,Q['length']),U=new Map(T['map'](Z=>[Z['service']['object'],Z['result']])),V=new Set(Q['map'](Z=>Z['object'])),W=N['filter'](Z=>V['has'](Z['id']))['map'](Z=>{const a0=J['services']['find'](a1=>a1['object']===Z['id']);return{'service':serviceSummaryToExtract(a0),'location':{'relation':Z['relation'],'satisfied':Z['satisfied'],'score':Z['score'],'reason':Z['reason']},'result':U['get'](Z['id'])};});c={'action':'match_discover','sensitivity':E,'inference_signals':F,'matches':W,'total_enumerated':J['total_enumerated'],'has_more':J['has_more'],'scope_advice':{'search_terms':I['search_terms'],'ai_enrichment_note':I['ai_enrichment_note']}};break;}case'arbitration_score':{let Z=b['history'];const a0=b['context_network']??'testnet';if((!Z||Z['length']===0x0)&&b['arbitration']['object'])try{const a2=await query_arbs({'arbitration':b['arbitration']['object'],'network':a0});Z=await arbCasesWithRoles(a2['arbs'],a0);}catch{Z=b['history'];}if((!Z||Z['length']===0x0)&&b['arbitration']['object'])try{const a3=await query_objects({'objects':[b['arbitration']['object']],'network':a0}),a4=a3?.['objects']?.[0x0];if(a4?.['permission']){const a5=await queryTableItem_EntityLinker({'address':a4['permission'],'network':a0}),a6=(a5?.['votes']??[])['filter'](a8=>a8['affiliation'])['map'](a8=>a8['address'])['filter'](a8=>a8!==b['arbitration']['object']),a7=[];for(const a8 of a6['slice'](0x0,0xa)){const a9=await query_arbs({'arbitration':a8,'network':a0})['catch'](()=>undefined);a9?.['arbs']?.['length']&&a7['push'](...await arbCasesWithRoles(a9['arbs'],a0));}if(a7['length']>0x0)Z=a7;}}catch{}const a1=await assessArbitration({'arbitration':{'object':b['arbitration']['object'],'fee':b['arbitration']['fee'],'balance':b['arbitration']['balance'],'voting_guard_count':b['arbitration']['voting_guard_count'],'bPaused':b['arbitration']['bPaused'],'location':b['arbitration']['location'],'has_verified_identity':b['arbitration']['has_verified_identity']},'history':Z,'entity_votes':b['entity_votes'],'fee_median':b['fee_median']},await resolveInjection(b['account'],b['injection']));c={'action':'arbitration_score',...a1};break;}case'account_events':{const aa=await runAccountEventWatchers({'account':b['account'],'network':b['context_network']??'testnet','reviews':b['reviews']?.['map'](ab=>({'reviewer':ab['reviewer'],'rating':ab['rating'],'tags':ab['tags'],'comment':ab['comment'],'orderRef':ab['orderRef'],'timestamp':ab['timestamp'],'verified':ab['verified']??![]})),'order_history':b['order_history']},b['categories']);c={'action':'account_events','events':aa};break;}default:throw new Error('Unknown\x20evaluation_operation\x20action');}return{'content':[{'type':'text','text':JSON['stringify']({'result':c})}],'structuredContent':{'result':c}};}
|
|
@@ -1,90 +1 @@
|
|
|
1
|
-
import { resolve }
|
|
2
|
-
import { strictParse, getEnvConfig, Guard2File_InputSchema, MachineNode2File_InputSchema, } from "../../schema/index.js";
|
|
3
|
-
import { guard2file, machineNode2file, } from "@wowok/wowok";
|
|
4
|
-
export async function handleGuard2File(args) {
|
|
5
|
-
const validated = strictParse(Guard2File_InputSchema, args, "guard2file input");
|
|
6
|
-
const env = getEnvConfig(validated.env);
|
|
7
|
-
try {
|
|
8
|
-
await guard2file(validated.guard, validated.file_path, validated.format || "json", env.network);
|
|
9
|
-
const result = {
|
|
10
|
-
result: {
|
|
11
|
-
status: "success",
|
|
12
|
-
data: {
|
|
13
|
-
file_path: resolve(validated.file_path),
|
|
14
|
-
format: validated.format || "json",
|
|
15
|
-
guard_object: validated.guard,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
return {
|
|
20
|
-
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
21
|
-
structuredContent: result,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
catch (error) {
|
|
25
|
-
const result = {
|
|
26
|
-
result: {
|
|
27
|
-
status: "error",
|
|
28
|
-
error: error.message,
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
return {
|
|
32
|
-
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
33
|
-
structuredContent: result,
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export async function handleMachineNode2File(args) {
|
|
38
|
-
const validated = strictParse(MachineNode2File_InputSchema, args, "machineNode2file input");
|
|
39
|
-
const env = getEnvConfig(validated.env);
|
|
40
|
-
try {
|
|
41
|
-
await machineNode2file(validated.machine, validated.file_path, validated.format || "json", env.network);
|
|
42
|
-
let node_count = undefined;
|
|
43
|
-
try {
|
|
44
|
-
const filePath = resolve(validated.file_path);
|
|
45
|
-
const fileContent = await import('fs/promises').then(fs => fs.readFile(filePath, 'utf-8'));
|
|
46
|
-
if ((validated.format || "json") === "json") {
|
|
47
|
-
const parsed = JSON.parse(fileContent);
|
|
48
|
-
if (Array.isArray(parsed)) {
|
|
49
|
-
node_count = parsed.length;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
else {
|
|
53
|
-
const nodeMatches = fileContent.match(/^##\s+Node:/gm);
|
|
54
|
-
node_count = nodeMatches ? nodeMatches.length : 0;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch {
|
|
58
|
-
node_count = undefined;
|
|
59
|
-
}
|
|
60
|
-
const result = {
|
|
61
|
-
result: {
|
|
62
|
-
status: "success",
|
|
63
|
-
data: {
|
|
64
|
-
file_path: resolve(validated.file_path),
|
|
65
|
-
format: validated.format || "json",
|
|
66
|
-
machine_object: validated.machine,
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
if (node_count !== undefined) {
|
|
71
|
-
result.result.data.node_count = node_count;
|
|
72
|
-
}
|
|
73
|
-
return {
|
|
74
|
-
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
75
|
-
structuredContent: result,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
const result = {
|
|
80
|
-
result: {
|
|
81
|
-
status: "error",
|
|
82
|
-
error: error.message,
|
|
83
|
-
},
|
|
84
|
-
};
|
|
85
|
-
return {
|
|
86
|
-
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
87
|
-
structuredContent: result,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
}
|
|
1
|
+
import{resolve}from'path';import{strictParse,getEnvConfig,Guard2File_InputSchema,MachineNode2File_InputSchema}from'../../schema/index.js';import{guard2file,machineNode2file}from'@wowok/wowok';export async function handleGuard2File(a){const b=strictParse(Guard2File_InputSchema,a,'guard2file\x20input'),c=getEnvConfig(b['env']);try{const d=await guard2file(b['guard'],b['file_path'],b['format']||'json',c['network']),e={'result':{'status':'success','data':{'file_path':resolve(d),'format':b['format']||'json','guard':b['guard']}}};return{'content':[{'type':'text','text':JSON['stringify'](e)}],'structuredContent':e};}catch(f){const g={'result':{'status':'error','error':f['message']}};return{'content':[{'type':'text','text':JSON['stringify'](g)}],'structuredContent':g};}}export async function handleMachineNode2File(a){const b=strictParse(MachineNode2File_InputSchema,a,'machineNode2file\x20input'),c=getEnvConfig(b['env']);try{const d=await machineNode2file(b['machine'],b['file_path'],b['format']||'json',c['network']);let e=undefined;try{const g=resolve(d),h=await import('fs/promises')['then'](i=>i['readFile'](g,'utf-8'));if((b['format']||'json')==='json'){const i=JSON['parse'](h);Array['isArray'](i)&&(e=i['length']);}else{const j=h['match'](/^##\s+Node:/gm);e=j?j['length']:0x0;}}catch{e=undefined;}const f={'result':{'status':'success','data':{'file_path':resolve(d),'format':b['format']||'json','machine_object':b['machine']}}};return e!==undefined&&(f['result']['data']['node_count']=e),{'content':[{'type':'text','text':JSON['stringify'](f)}],'structuredContent':f};}catch(k){const l={'result':{'status':'error','error':k['message']}};return{'content':[{'type':'text','text':JSON['stringify'](l)}],'structuredContent':l};}}
|