@wowok/agent-mcp 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.js +1 -1
- package/dist/config/runtime.js +1 -238
- package/dist/customer/customer-advice.js +1 -130
- package/dist/customer/index.js +1 -11
- package/dist/customer/industry-risks.js +1 -438
- package/dist/customer/info-puzzle.js +1 -681
- package/dist/customer/order-monitor.js +1 -328
- package/dist/customer/order-strategy.js +1 -373
- package/dist/customer/post-purchase.js +1 -351
- package/dist/customer/preorder-compare.js +1 -34
- package/dist/customer/reminder-system.js +1 -316
- package/dist/customer/risk-assessment.d.ts +5 -1
- package/dist/customer/risk-assessment.js +1 -397
- package/dist/customer/types.js +1 -13
- package/dist/customer/user-preferences.js +1 -460
- package/dist/evaluation/arbitration-game.d.ts +23 -0
- package/dist/evaluation/arbitration-game.js +1 -0
- package/dist/evaluation/builtins/demand-match.d.ts +15 -0
- package/dist/evaluation/builtins/demand-match.js +1 -0
- package/dist/evaluation/builtins/index.d.ts +3 -0
- package/dist/evaluation/builtins/index.js +1 -0
- package/dist/evaluation/builtins/service-risk.d.ts +6 -0
- package/dist/evaluation/builtins/service-risk.js +1 -0
- package/dist/evaluation/capability.d.ts +50 -0
- package/dist/evaluation/capability.js +1 -0
- package/dist/evaluation/composer.d.ts +13 -0
- package/dist/evaluation/composer.js +1 -0
- package/dist/evaluation/engine.d.ts +18 -0
- package/dist/evaluation/engine.js +1 -0
- package/dist/evaluation/extract.d.ts +30 -0
- package/dist/evaluation/extract.js +1 -0
- package/dist/evaluation/game-strategy.d.ts +27 -0
- package/dist/evaluation/game-strategy.js +1 -0
- package/dist/evaluation/gap.d.ts +2 -0
- package/dist/evaluation/gap.js +1 -0
- package/dist/evaluation/index.d.ts +12 -0
- package/dist/evaluation/index.js +1 -0
- package/dist/evaluation/node-game.d.ts +62 -0
- package/dist/evaluation/node-game.js +1 -0
- package/dist/evaluation/region.d.ts +10 -0
- package/dist/evaluation/region.js +1 -0
- package/dist/evaluation/types.d.ts +77 -0
- package/dist/evaluation/types.js +1 -0
- package/dist/evaluation/user-injection.d.ts +6 -0
- package/dist/evaluation/user-injection.js +1 -0
- package/dist/examples/education-contact-create.json +40 -0
- package/dist/examples/freelance-contact-create.json +40 -0
- package/dist/examples/insurance-machine-create.json +1 -1
- package/dist/examples/insurance-service-allocators.json +1 -1
- package/dist/examples/machine-publish.json +1 -1
- package/dist/examples/rental-ziroom-service-create.json +1 -1
- package/dist/examples/retail-adv-guard-messenger-proof-create.json +1 -1
- package/dist/examples/retail-myshop-service-create.json +1 -1
- package/dist/examples/retail-myshop-service-customer-required.json +1 -1
- package/dist/examples/subscription-contact-create.json +40 -0
- package/dist/examples/threebody-machine-create.json +1 -1
- package/dist/examples/travel-machine-create.json +1 -1
- package/dist/examples/travel-service-create.json +1 -1
- package/dist/experience/experience-reuse.js +1 -103
- package/dist/experience/index.js +1 -5
- package/dist/experience/intent-distill.js +1 -83
- package/dist/experience/realtime-feedback.js +1 -94
- package/dist/experience/types.js +1 -1
- package/dist/experience/user-profile.js +1 -171
- package/dist/extensions/business-modules.js +1 -287
- package/dist/extensions/capability-manifest.js +1 -781
- package/dist/extensions/constraint-registry.js +1 -198
- package/dist/extensions/index.js +1 -6
- package/dist/extensions/metric-registry.js +1 -257
- package/dist/extensions/mode-evaluator.js +1 -170
- package/dist/extensions/modes.js +1 -499
- package/dist/extensions/registry.js +1 -717
- package/dist/extensions/types.js +1 -1
- package/dist/harness/auto-escalation.js +1 -68
- package/dist/harness/checkpoint.js +1 -129
- package/dist/harness/index.js +1 -78
- package/dist/harness/plan.js +1 -276
- package/dist/harness/recover.js +1 -139
- package/dist/harness/types.js +1 -1
- package/dist/harness/verify.js +1 -237
- package/dist/index.js +1 -273
- package/dist/intent/enrich.d.ts +1 -0
- package/dist/intent/enrich.js +1 -0
- package/dist/intent/index.d.ts +23 -0
- package/dist/intent/index.js +1 -0
- package/dist/intent/matcher.d.ts +2 -0
- package/dist/intent/matcher.js +1 -0
- package/dist/intent/store.d.ts +19 -0
- package/dist/intent/store.js +1 -0
- package/dist/intent/types.d.ts +33 -0
- package/dist/intent/types.js +1 -0
- package/dist/knowledge/acquisition-flywheel.js +1 -192
- package/dist/knowledge/allocation-confirm.js +1 -534
- package/dist/knowledge/allocation-context.js +1 -249
- package/dist/knowledge/allocation-ledger.js +1 -463
- package/dist/knowledge/allocation-puzzle.js +1 -298
- package/dist/knowledge/allocation-risk.js +1 -568
- package/dist/knowledge/allocation-templates.js +1 -970
- package/dist/knowledge/allocation-translation.js +1 -585
- package/dist/knowledge/arb-risk.js +1 -210
- package/dist/knowledge/arbitration-confirm.js +1 -559
- package/dist/knowledge/arbitration-context.js +1 -505
- package/dist/knowledge/arbitration-ledger.js +1 -521
- package/dist/knowledge/arbitration-puzzle.js +1 -304
- package/dist/knowledge/arbitration-risk.js +1 -433
- package/dist/knowledge/arbitration-templates.js +1 -276
- package/dist/knowledge/arbitration-translation.js +1 -487
- package/dist/knowledge/arbitration-trust.js +1 -117
- package/dist/knowledge/audit-rules.js +1 -141
- package/dist/knowledge/bridge-risk.js +1 -263
- package/dist/knowledge/contact-risk.js +1 -200
- package/dist/knowledge/contact-templates.d.ts +27 -0
- package/dist/knowledge/contact-templates.js +1 -0
- package/dist/knowledge/demand-confirm.js +1 -206
- package/dist/knowledge/demand-matching.js +1 -132
- package/dist/knowledge/demand-risk.js +1 -240
- package/dist/knowledge/demand-translation.js +1 -354
- package/dist/knowledge/deployment-scanner.js +1 -823
- package/dist/knowledge/dynamic-pricing.js +1 -87
- package/dist/knowledge/examples-scanner-cli.js +1 -26
- package/dist/knowledge/examples-scanner.js +1 -825
- package/dist/knowledge/flywheel-loop.js +1 -404
- package/dist/knowledge/fund-layer.js +1 -973
- package/dist/knowledge/glossary.js +1 -211
- package/dist/knowledge/guard-confirm.js +1 -406
- package/dist/knowledge/guard-context.js +1 -287
- package/dist/knowledge/guard-design-patterns.js +1 -360
- package/dist/knowledge/guard-ledger.js +1 -260
- package/dist/knowledge/guard-lint.js +1 -670
- package/dist/knowledge/guard-migration.js +1 -228
- package/dist/knowledge/guard-puzzle.js +1 -805
- package/dist/knowledge/guard-render.js +1 -700
- package/dist/knowledge/guard-risk.js +1 -1879
- package/dist/knowledge/guard-submission-prompt.js +1 -171
- package/dist/knowledge/guard-templates.js +1 -1105
- package/dist/knowledge/guard-translation.js +1 -1119
- package/dist/knowledge/index.js +1 -436
- package/dist/knowledge/industry-evolution.js +1 -323
- package/dist/knowledge/industry-generalizer.js +1 -381
- package/dist/knowledge/industry-registry.js +1 -174
- package/dist/knowledge/intent-metrics.d.ts +4 -3
- package/dist/knowledge/intent-metrics.js +1 -566
- package/dist/knowledge/machine-confirm.js +1 -559
- package/dist/knowledge/machine-context.js +1 -833
- package/dist/knowledge/machine-ledger.js +1 -338
- package/dist/knowledge/machine-puzzle.js +1 -494
- package/dist/knowledge/machine-render.js +1 -565
- package/dist/knowledge/machine-risk.js +1 -670
- package/dist/knowledge/machine-templates.js +1 -1597
- package/dist/knowledge/machine-topology.js +1 -234
- package/dist/knowledge/machine-translation.js +1 -513
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
- package/dist/knowledge/mcp-schema-audit.d.ts +1 -1
- package/dist/knowledge/mcp-schema-audit.js +1 -773
- package/dist/knowledge/onchain-constants.js +1 -35
- package/dist/knowledge/order-confirm.js +1 -573
- package/dist/knowledge/order-context.js +1 -390
- package/dist/knowledge/order-ledger.js +1 -341
- package/dist/knowledge/order-puzzle.js +1 -255
- package/dist/knowledge/order-risk.js +1 -653
- package/dist/knowledge/order-templates.js +1 -368
- package/dist/knowledge/order-translation.js +1 -550
- package/dist/knowledge/overrides-loader.js +1 -65
- package/dist/knowledge/passport-confirm.js +1 -531
- package/dist/knowledge/passport-context.js +1 -306
- package/dist/knowledge/passport-ledger.js +1 -282
- package/dist/knowledge/passport-puzzle.js +1 -333
- package/dist/knowledge/passport-risk.js +1 -450
- package/dist/knowledge/passport-templates.js +1 -568
- package/dist/knowledge/passport-translation.js +1 -516
- package/dist/knowledge/payment-risk.js +1 -249
- package/dist/knowledge/permission-confirm.js +1 -426
- package/dist/knowledge/permission-context.js +1 -224
- package/dist/knowledge/permission-ledger.js +1 -403
- package/dist/knowledge/permission-puzzle.js +1 -173
- package/dist/knowledge/permission-risk.js +1 -411
- package/dist/knowledge/permission-templates.js +1 -234
- package/dist/knowledge/permission-translation.js +1 -350
- package/dist/knowledge/personal-risk.js +1 -212
- package/dist/knowledge/process-model.js +1 -160
- package/dist/knowledge/progress-confirm.js +1 -456
- package/dist/knowledge/progress-context.js +1 -452
- package/dist/knowledge/progress-ledger.js +1 -330
- package/dist/knowledge/progress-puzzle.js +1 -219
- package/dist/knowledge/progress-risk.js +1 -461
- package/dist/knowledge/progress-templates.js +1 -228
- package/dist/knowledge/progress-translation.js +1 -405
- package/dist/knowledge/proof-confirm.js +1 -187
- package/dist/knowledge/proof-risk.js +1 -207
- package/dist/knowledge/proof-translation.js +1 -283
- package/dist/knowledge/registrar-risk.js +1 -217
- package/dist/knowledge/repository-confirm.js +1 -286
- package/dist/knowledge/repository-risk.js +1 -373
- package/dist/knowledge/repository-translation.js +1 -445
- package/dist/knowledge/reputation-rules.js +1 -99
- package/dist/knowledge/resource-risk.js +1 -157
- package/dist/knowledge/reward-confirm.js +1 -526
- package/dist/knowledge/reward-context.js +1 -504
- package/dist/knowledge/reward-ledger.js +1 -502
- package/dist/knowledge/reward-puzzle.js +1 -300
- package/dist/knowledge/reward-risk.js +1 -627
- package/dist/knowledge/reward-templates.js +1 -197
- package/dist/knowledge/reward-translation.js +1 -501
- package/dist/knowledge/safety-rules.js +1 -404
- package/dist/knowledge/scenario-modes.js +1 -321
- package/dist/knowledge/service-confirm.js +1 -807
- package/dist/knowledge/service-context.js +1 -403
- package/dist/knowledge/service-ledger.js +1 -609
- package/dist/knowledge/service-puzzle.js +1 -236
- package/dist/knowledge/service-risk.js +1 -615
- package/dist/knowledge/service-templates.js +1 -456
- package/dist/knowledge/service-translation.js +1 -622
- package/dist/knowledge/template-registry.d.ts +1 -1
- package/dist/knowledge/template-registry.js +1 -341
- package/dist/knowledge/tool-constraints.js +1 -195
- package/dist/knowledge/tools-reference.js +1 -155
- package/dist/knowledge/treasury-confirm.js +1 -512
- package/dist/knowledge/treasury-context.js +1 -363
- package/dist/knowledge/treasury-ledger.js +1 -300
- package/dist/knowledge/treasury-puzzle.js +1 -216
- package/dist/knowledge/treasury-risk.js +1 -440
- package/dist/knowledge/treasury-templates.js +1 -358
- package/dist/knowledge/treasury-translation.js +1 -498
- package/dist/knowledge/trust-metrics.js +1 -198
- package/dist/knowledge/util-risk.js +1 -135
- package/dist/loop-engineering/aggregate.js +1 -132
- package/dist/loop-engineering/context-collect.js +1 -83
- package/dist/loop-engineering/diagnose.js +1 -273
- package/dist/loop-engineering/improve.js +1 -405
- package/dist/loop-engineering/index.js +1 -4
- package/dist/loop-engineering/pipeline.js +1 -56
- package/dist/mode-market/index.js +1 -3
- package/dist/mode-market/registry.js +1 -124
- package/dist/mode-market/review.js +1 -214
- package/dist/mode-market/submission.js +1 -85
- package/dist/participation/collaborator-interest.d.ts +23 -0
- package/dist/participation/collaborator-interest.js +1 -0
- package/dist/participation/customer-interest.d.ts +25 -0
- package/dist/participation/customer-interest.js +1 -0
- package/dist/participation/merchant-interest.js +1 -100
- package/dist/participation/radar-core.d.ts +13 -3
- package/dist/participation/radar-core.js +1 -269
- package/dist/participation/supplier-interest.d.ts +25 -0
- package/dist/participation/supplier-interest.js +1 -0
- package/dist/persona/analyzer.d.ts +16 -0
- package/dist/persona/analyzer.js +1 -0
- package/dist/persona/bridge.d.ts +5 -0
- package/dist/persona/bridge.js +1 -0
- package/dist/persona/defaults.d.ts +4 -0
- package/dist/persona/defaults.js +1 -0
- package/dist/persona/experience-bridge.d.ts +3 -0
- package/dist/persona/experience-bridge.js +1 -0
- package/dist/persona/index.d.ts +18 -0
- package/dist/persona/index.js +1 -0
- package/dist/persona/model.d.ts +7 -0
- package/dist/persona/model.js +1 -0
- package/dist/persona/store.d.ts +19 -0
- package/dist/persona/store.js +1 -0
- package/dist/persona/types.d.ts +45 -0
- package/dist/persona/types.js +1 -0
- package/dist/project/business-puzzle.js +1 -383
- package/dist/project/context-assembly.js +1 -254
- package/dist/project/deployment-bridge.js +1 -120
- package/dist/project/deployment-doc.js +1 -1126
- package/dist/project/edit-planner.js +1 -1342
- package/dist/project/evaluation.js +1 -2011
- package/dist/project/game-theory.js +1 -177
- package/dist/project/graph-builder.js +1 -656
- package/dist/project/graph.js +1 -340
- package/dist/project/handlers.d.ts +5 -0
- package/dist/project/handlers.js +1 -1762
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +1 -301
- package/dist/project/intent-analyzer.js +1 -149
- package/dist/project/machine-nodes.js +1 -36
- package/dist/project/merchant-guide.js +1 -264
- package/dist/project/migration.js +1 -125
- package/dist/project/mode-actions.js +1 -309
- package/dist/project/namespace.js +1 -206
- package/dist/project/participation-radar.js +1 -428
- package/dist/project/pipeline-actions.js +1 -109
- package/dist/project/project-store.js +1 -422
- package/dist/project/query.js +1 -153
- package/dist/project/reverse-mapping.d.ts +34 -0
- package/dist/project/reverse-mapping.js +1 -0
- package/dist/project/risk-aggregator.js +1 -295
- package/dist/project/rollback-policy.js +1 -290
- package/dist/project/semantic-assembler.js +1 -345
- package/dist/project/semantic-graph.js +1 -245
- package/dist/project/stage-gate.js +1 -369
- package/dist/project/substep-trace.js +1 -332
- package/dist/project/task-tracker.js +1 -78
- package/dist/role/derivation.d.ts +18 -0
- package/dist/role/derivation.js +1 -0
- package/dist/role/index.d.ts +5 -0
- package/dist/role/index.js +1 -0
- package/dist/role/model.d.ts +8 -0
- package/dist/role/model.js +1 -0
- package/dist/role/resolution.d.ts +11 -0
- package/dist/role/resolution.js +1 -0
- package/dist/role/types.d.ts +11 -0
- package/dist/role/types.js +1 -0
- package/dist/rules.d.ts +2 -0
- package/dist/rules.js +1 -9
- package/dist/safety/confirm-gate.js +1 -88
- package/dist/safety/index.js +1 -3
- package/dist/safety/preview.js +1 -52
- package/dist/schema/call/allocation.js +1 -34
- package/dist/schema/call/arbitration.js +1 -113
- package/dist/schema/call/base.d.ts +15 -15
- package/dist/schema/call/base.js +1 -370
- package/dist/schema/call/bridge-handler.js +1 -265
- package/dist/schema/call/bridge.d.ts +7 -7
- package/dist/schema/call/bridge.js +1 -458
- package/dist/schema/call/contact.js +1 -37
- package/dist/schema/call/demand.js +1 -47
- package/dist/schema/call/guard.js +1 -161
- package/dist/schema/call/handler.js +1 -322
- package/dist/schema/call/index.js +1 -20
- package/dist/schema/call/machine.js +1 -193
- package/dist/schema/call/order.js +1 -35
- package/dist/schema/call/payment.js +1 -37
- package/dist/schema/call/permission-handler.js +1 -54
- package/dist/schema/call/permission.js +1 -105
- package/dist/schema/call/personal.js +1 -78
- package/dist/schema/call/progress.js +1 -47
- package/dist/schema/call/proof.js +1 -33
- package/dist/schema/call/repository.js +1 -77
- package/dist/schema/call/reward.js +1 -30
- package/dist/schema/call/semantic.js +1 -1657
- package/dist/schema/call/service.js +1 -178
- package/dist/schema/call/treasury.js +1 -71
- package/dist/schema/common/index.js +1 -407
- package/dist/schema/config/index.js +1 -68
- package/dist/schema/evaluation/index.d.ts +4436 -0
- package/dist/schema/evaluation/index.js +1 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.js +1 -13
- package/dist/schema/intent-radar/index.d.ts +284 -0
- package/dist/schema/intent-radar/index.js +1 -0
- package/dist/schema/local/index.d.ts +21 -21
- package/dist/schema/local/index.js +1 -927
- package/dist/schema/local/wip.js +1 -187
- package/dist/schema/messenger/index.d.ts +7 -7
- package/dist/schema/messenger/index.js +1 -475
- package/dist/schema/operations.d.ts +7 -7
- package/dist/schema/operations.js +1 -520
- package/dist/schema/persona/index.d.ts +1985 -0
- package/dist/schema/persona/index.js +1 -0
- package/dist/schema/project/index.d.ts +96 -50
- package/dist/schema/project/index.js +1 -2057
- package/dist/schema/query/index.d.ts +423 -7
- package/dist/schema/query/index.js +1 -1640
- package/dist/schema/schema-query/index.js +1 -104
- package/dist/schema/schema-version.js +1 -76
- package/dist/schema/sync-layer4.d.ts +1 -1
- package/dist/schema/sync-layer4.js +1 -282
- package/dist/schema/task-status.d.ts +168 -0
- package/dist/schema/task-status.js +1 -0
- package/dist/schema/trust/index.js +1 -314
- package/dist/schema/utils/guard-parser.js +1 -419
- package/dist/schema/utils/guard-query-utils.js +1 -46
- package/dist/schema/utils/node-parser.js +1 -369
- package/dist/schema/utils/object-type-utils.js +1 -35
- package/dist/schema/utils/permission-index-utils.js +1 -7
- package/dist/schema/utils/permission-machine-check.js +1 -121
- package/dist/schema/utils/skills-recommendation.js +1 -77
- package/dist/schema-query/index.js +1 -810
- package/dist/schemas/account_operation.output.json +5 -2
- package/dist/schemas/bridge_operation.output.json +5 -2
- package/dist/schemas/evaluation_operation.output.json +782 -0
- package/dist/schemas/evaluation_operation.schema.json +990 -0
- package/dist/schemas/index.json +25 -1
- package/dist/schemas/intent_radar.output.json +232 -0
- package/dist/schemas/intent_radar.schema.json +138 -0
- package/dist/schemas/local_info_operation.output.json +5 -2
- package/dist/schemas/local_mark_operation.output.json +5 -2
- package/dist/schemas/messenger_operation.output.json +5 -2
- package/dist/schemas/onchain_events.output.json +5 -2
- package/dist/schemas/onchain_operations.output.json +5 -2
- package/dist/schemas/onchain_operations.schema.json +6 -6
- package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +2 -2
- package/dist/schemas/onchain_operations_service.schema.json +3 -3
- package/dist/schemas/onchain_table_data.output.json +6 -3
- package/dist/schemas/persona_operation.output.json +392 -0
- package/dist/schemas/persona_operation.schema.json +250 -0
- package/dist/schemas/project_operation.output.json +28 -8
- package/dist/schemas/query_task_status.output.json +115 -0
- package/dist/schemas/query_task_status.schema.json +24 -0
- package/dist/schemas/query_toolkit.output.json +9 -6
- package/dist/schemas/trust_score.schema.json +1 -1
- package/dist/schemas/wowok_buildin_info.output.json +132 -0
- package/dist/schemas/wowok_buildin_info.schema.json +14 -0
- package/dist/telemetry/index.js +1 -112
- package/dist/telemetry/redact.js +1 -23
- package/dist/telemetry/storage.js +1 -80
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -74
- package/dist/tools/handlers/evaluation.d.ts +2 -0
- package/dist/tools/handlers/evaluation.js +1 -0
- package/dist/tools/handlers/file-export.js +1 -90
- package/dist/tools/handlers/intent-radar.d.ts +2 -0
- package/dist/tools/handlers/intent-radar.js +1 -0
- package/dist/tools/handlers/local.js +1 -53
- package/dist/tools/handlers/messenger.js +1 -188
- package/dist/tools/handlers/onchain.js +1 -1082
- package/dist/tools/handlers/persona.d.ts +4 -0
- package/dist/tools/handlers/persona.js +1 -0
- package/dist/tools/handlers/project.js +1 -211
- package/dist/tools/handlers/query.js +1 -434
- package/dist/tools/handlers/schema-query.js +1 -176
- package/dist/tools/handlers/task-status.d.ts +0 -168
- package/dist/tools/handlers/task-status.js +1 -55
- package/dist/tools/handlers/trust.js +1 -380
- package/dist/tools/handlers/wip.js +1 -90
- package/dist/tools/index.js +1 -1306
- package/dist/tools/retry.js +1 -85
- package/dist/tools/rules-hook.js +1 -23
- package/dist/tools/shared.js +1 -130
- package/dist/tools/types.js +1 -1
- package/dist/tools/upgrade-check.d.ts +19 -0
- package/dist/tools/upgrade-check.js +1 -0
- package/dist/tools/wip-deploy-assist.d.ts +1 -1
- package/dist/tools/wip-deploy-assist.js +1 -278
- package/dist/tools/wrap.js +1 -500
- package/package.json +5 -3
|
@@ -1,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 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{handleBridgeOperations}from'../../schema/call/bridge-handler.js';
|
|
@@ -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 a300a,setEnabled as a300b,reset as a300c}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=a300a(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.');a300b(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.');a300b(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.');a300c(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{EvaluationOperationInputSchema}from'../../schema/evaluation/index.js';import{evaluateArbGame}from'../../evaluation/arbitration-game.js';import{evaluateNodeGame}from'../../evaluation/node-game.js';import{summarizeCapabilityGaps}from'../../evaluation/gap.js';import{composeServicesForDemand}from'../../evaluation/composer.js';import{matchDemandToServices,matchServiceToDemands}from'../../evaluation/builtins/demand-match.js';import{assessServiceRisk}from'../../evaluation/builtins/service-risk.js';import{registerBuiltinEvaluations}from'../../evaluation/builtins/index.js';import{getEffectivePersona,mergeInjections,personaToInjection}from'../../persona/index.js';registerBuiltinEvaluations();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);}export async function handleEvaluationOperation(a){const b=strictParse(EvaluationOperationInputSchema,a,'evaluation_operation\x20input');let c;switch(b['action']){case'arb_game':{const d=b['account']?await getEffectivePersona(b['account']):null,e=b['appetite']??d?.['layer']['preferences']?.['risk_appetite'],f=b['requirements']??d?.['layer']['requirements'];c={'action':'arb_game',...evaluateArbGame(b['status'],b['perspective'],{'risk_appetite':e,'requirements':f})};break;}case'node_game':{const g=b['account']?await getEffectivePersona(b['account']):null,h=b['appetite']??g?.['layer']['preferences']?.['risk_appetite'],i=b['requirements']??g?.['layer']['requirements'];c={'action':'node_game',...evaluateNodeGame({'current_node':b['current_node'],'perspective':b['perspective'],'appetite':h,'requirements':i,'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;}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{await guard2file(b['guard'],b['file_path'],b['format']||'json',c['network']);const d={'result':{'status':'success','data':{'file_path':resolve(b['file_path']),'format':b['format']||'json','guard_object':b['guard']}}};return{'content':[{'type':'text','text':JSON['stringify'](d)}],'structuredContent':d};}catch(e){const f={'result':{'status':'error','error':e['message']}};return{'content':[{'type':'text','text':JSON['stringify'](f)}],'structuredContent':f};}}export async function handleMachineNode2File(a){const b=strictParse(MachineNode2File_InputSchema,a,'machineNode2file\x20input'),c=getEnvConfig(b['env']);try{await machineNode2file(b['machine'],b['file_path'],b['format']||'json',c['network']);let d=undefined;try{const f=resolve(b['file_path']),g=await import('fs/promises')['then'](h=>h['readFile'](f,'utf-8'));if((b['format']||'json')==='json'){const h=JSON['parse'](g);Array['isArray'](h)&&(d=h['length']);}else{const i=g['match'](/^##\s+Node:/gm);d=i?i['length']:0x0;}}catch{d=undefined;}const e={'result':{'status':'success','data':{'file_path':resolve(b['file_path']),'format':b['format']||'json','machine_object':b['machine']}}};return d!==undefined&&(e['result']['data']['node_count']=d),{'content':[{'type':'text','text':JSON['stringify'](e)}],'structuredContent':e};}catch(j){const k={'result':{'status':'error','error':j['message']}};return{'content':[{'type':'text','text':JSON['stringify'](k)}],'structuredContent':k};}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{strictParse}from'../../schema/index.js';import{IntentRadarInputSchema}from'../../schema/intent-radar/index.js';import{createIntent,listIntents,matchAllIntents,matchIntent,removeIntent}from'../../intent/index.js';import{enrichEventsWithObjectText}from'../../intent/enrich.js';import{query_events}from'@wowok/wowok';const AUTO_PULL_TYPES=['NewOrderEvent','DemandPresentEvent','DemandFeedbackEvent','ProgressEvent','NewEntityEvent','ArbEvent'];async function pullRecentEvents(a,b){const c=[];for(const d of AUTO_PULL_TYPES){try{const e=await query_events({'type':d,'cursor':null,'limit':b,'order':'descending','no_cache':![],'network':a}),f=e?.['data'];if(Array['isArray'](f))c['push'](...f);}catch{}}return c;}export async function handleIntentRadar(a){const b=strictParse(IntentRadarInputSchema,a,'intent_radar\x20input');let c;switch(b['action']){case'save':{const d=await createIntent({'intent':b['intent'],'account':b['account'],'role':b['role'],'target_types':b['target_types']});c={'action':'save','intent':d};break;}case'list':{c={'action':'list','intents':await listIntents(b['account'])};break;}case'remove':{c={'action':'remove','removed':await removeIntent(b['id'])};break;}case'match':{let e=b['events']??[];e['length']===0x0&&(e=await pullRecentEvents(b['network'],b['limit']??0x5));e=await enrichEventsWithObjectText(e,b['network']);const f=b['intent_id']?[await matchIntent(b['intent_id'],e)]['filter'](g=>g!==null):await matchAllIntents(e,b['account']);c={'action':'match','results':f};break;}default:throw new Error('Unknown\x20intent_radar\x20action');}return{'content':[{'type':'text','text':JSON['stringify']({'result':c})}],'structuredContent':{'result':c}};}
|
|
@@ -1,53 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { withFaucetRetry } from "../retry.js";
|
|
3
|
-
import { AccountOperationSchema, LocalMarkOperationSchema, LocalInfoOperationSchema, } from "../../schema/index.js";
|
|
4
|
-
import { account_operation, local_mark_operation, local_info_operation, } from "@wowok/wowok";
|
|
5
|
-
function deriveOpType(prefix, validated) {
|
|
6
|
-
for (const key of Object.keys(validated)) {
|
|
7
|
-
if (validated[key] !== undefined) {
|
|
8
|
-
return `${prefix}_${String(key)}`;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return `${prefix}_unknown`;
|
|
12
|
-
}
|
|
13
|
-
export const handleAccountOperation = wrapLocalHandler({
|
|
14
|
-
schema: AccountOperationSchema,
|
|
15
|
-
operationFn: withFaucetRetry(account_operation),
|
|
16
|
-
parseLabel: "account_operation input",
|
|
17
|
-
buildContext: (validated) => ({
|
|
18
|
-
operation_type: deriveOpType("account", validated),
|
|
19
|
-
data: validated,
|
|
20
|
-
}),
|
|
21
|
-
});
|
|
22
|
-
export const handleMarkOperation = wrapLocalHandler({
|
|
23
|
-
schema: LocalMarkOperationSchema,
|
|
24
|
-
operationFn: local_mark_operation,
|
|
25
|
-
parseLabel: "local_mark_operation input",
|
|
26
|
-
buildContext: (validated) => {
|
|
27
|
-
const ctx = {
|
|
28
|
-
operation_type: deriveOpType("mark", validated),
|
|
29
|
-
data: validated,
|
|
30
|
-
};
|
|
31
|
-
const v = validated;
|
|
32
|
-
if (v.add && Array.isArray(v.add.data) && v.add.data.length > 0) {
|
|
33
|
-
ctx.pre_warnings = [
|
|
34
|
-
"Cross-network consistency (FIX-011): LocalMark names are scoped per network. " +
|
|
35
|
-
"When creating marks for the same logical object on different networks " +
|
|
36
|
-
"(e.g. testnet and mainnet), use the SAME name value to keep name-based " +
|
|
37
|
-
"references portable. Before creating a mark on mainnet, consider querying " +
|
|
38
|
-
"testnet via query_local with network='testnet' to check for an existing " +
|
|
39
|
-
"same-named mark and replicate it.",
|
|
40
|
-
];
|
|
41
|
-
}
|
|
42
|
-
return ctx;
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
export const handleInfoOperation = wrapLocalHandler({
|
|
46
|
-
schema: LocalInfoOperationSchema,
|
|
47
|
-
operationFn: local_info_operation,
|
|
48
|
-
parseLabel: "local_info_operation input",
|
|
49
|
-
buildContext: (validated) => ({
|
|
50
|
-
operation_type: deriveOpType("local_info", validated),
|
|
51
|
-
data: validated,
|
|
52
|
-
}),
|
|
53
|
-
});
|
|
1
|
+
import{wrapLocalHandler}from'../shared.js';import{withFaucetRetry}from'../retry.js';import{AccountOperationSchema,LocalMarkOperationSchema,LocalInfoOperationSchema}from'../../schema/index.js';import{account_operation,local_mark_operation,local_info_operation}from'@wowok/wowok';function deriveOpType(a,b){for(const c of Object['keys'](b)){if(b[c]!==undefined)return a+'_'+String(c);}return a+'_unknown';}export const handleAccountOperation=wrapLocalHandler({'schema':AccountOperationSchema,'operationFn':withFaucetRetry(account_operation),'parseLabel':'account_operation\x20input','buildContext':a=>({'operation_type':deriveOpType('account',a),'data':a})});export const handleMarkOperation=wrapLocalHandler({'schema':LocalMarkOperationSchema,'operationFn':local_mark_operation,'parseLabel':'local_mark_operation\x20input','buildContext':a=>{const b={'operation_type':deriveOpType('mark',a),'data':a},c=a;return c['add']&&Array['isArray'](c['add']['data'])&&c['add']['data']['length']>0x0&&(b['pre_warnings']=['Cross-network\x20consistency\x20(FIX-011):\x20LocalMark\x20names\x20are\x20scoped\x20per\x20network.\x20'+'When\x20creating\x20marks\x20for\x20the\x20same\x20logical\x20object\x20on\x20different\x20networks\x20'+'(e.g.\x20testnet\x20and\x20mainnet),\x20use\x20the\x20SAME\x20name\x20value\x20to\x20keep\x20name-based\x20'+'references\x20portable.\x20Before\x20creating\x20a\x20mark\x20on\x20mainnet,\x20consider\x20querying\x20'+'testnet\x20via\x20query_local\x20with\x20network=\x27testnet\x27\x20to\x20check\x20for\x20an\x20existing\x20'+'same-named\x20mark\x20and\x20replicate\x20it.']),b;}});export const handleInfoOperation=wrapLocalHandler({'schema':LocalInfoOperationSchema,'operationFn':local_info_operation,'parseLabel':'local_info_operation\x20input','buildContext':a=>({'operation_type':deriveOpType('local_info',a),'data':a})});
|
|
@@ -1,188 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { watch_conversations, send_message, send_file, watch_messages, extract_zip_messages, pull_messages, generate_wts, verify_wts, sign_wts, wts2html, proof_message, mark_messages_as_viewed, mark_conversation_as_viewed, blacklist, friendslist, guardlist, settings, } from "@wowok/wowok";
|
|
3
|
-
import { classifyError, buildDataSemantic, } from "../../schema/call/semantic.js";
|
|
4
|
-
export function normalizeAccountOrMark(input) {
|
|
5
|
-
if (typeof input === 'string') {
|
|
6
|
-
return { name_or_address: input, local_mark_first: true };
|
|
7
|
-
}
|
|
8
|
-
return input;
|
|
9
|
-
}
|
|
10
|
-
export function normalizeManyAccountOrMark(input) {
|
|
11
|
-
if (Array.isArray(input)) {
|
|
12
|
-
return {
|
|
13
|
-
entities: input.map(item => typeof item === 'string' ? { name_or_address: item, local_mark_first: true } : item),
|
|
14
|
-
check_all_founded: true,
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
return input;
|
|
18
|
-
}
|
|
19
|
-
export async function handleMessengerOperation(args) {
|
|
20
|
-
let validated;
|
|
21
|
-
try {
|
|
22
|
-
validated = strictParse(MessengerOperationInputSchema, args, "messenger_operation input");
|
|
23
|
-
const opLiteral = validated.operation;
|
|
24
|
-
let result;
|
|
25
|
-
switch (validated.operation) {
|
|
26
|
-
case "watch_conversations": {
|
|
27
|
-
const conversations = await watch_conversations(validated.filter);
|
|
28
|
-
result = { operation: "watch_conversations", result: conversations };
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
case "send_message": {
|
|
32
|
-
const sendResult = await send_message(validated.from, normalizeAccountOrMark(validated.to), validated.content, validated.options);
|
|
33
|
-
const filteredResult = {
|
|
34
|
-
...sendResult,
|
|
35
|
-
merkleData: sendResult.merkleData ? {
|
|
36
|
-
leafIndex: sendResult.merkleData.leafIndex,
|
|
37
|
-
prevRoot: sendResult.merkleData.prevRoot,
|
|
38
|
-
newRoot: sendResult.merkleData.newRoot,
|
|
39
|
-
serverSignature: sendResult.merkleData.serverSignature,
|
|
40
|
-
serverTimestamp: sendResult.merkleData.serverTimestamp,
|
|
41
|
-
serverPublicKey: sendResult.merkleData.serverPublicKey,
|
|
42
|
-
} : undefined,
|
|
43
|
-
};
|
|
44
|
-
result = { operation: "send_message", result: filteredResult };
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
case "send_file": {
|
|
48
|
-
const sendResult = await send_file(validated.from, normalizeAccountOrMark(validated.to), validated.filePath, validated.options);
|
|
49
|
-
const filteredResult = {
|
|
50
|
-
...sendResult,
|
|
51
|
-
merkleData: sendResult.merkleData ? {
|
|
52
|
-
leafIndex: sendResult.merkleData.leafIndex,
|
|
53
|
-
prevRoot: sendResult.merkleData.prevRoot,
|
|
54
|
-
newRoot: sendResult.merkleData.newRoot,
|
|
55
|
-
serverSignature: sendResult.merkleData.serverSignature,
|
|
56
|
-
serverTimestamp: sendResult.merkleData.serverTimestamp,
|
|
57
|
-
serverPublicKey: sendResult.merkleData.serverPublicKey,
|
|
58
|
-
} : undefined,
|
|
59
|
-
};
|
|
60
|
-
result = { operation: "send_file", result: filteredResult };
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
case "watch_messages": {
|
|
64
|
-
const filter = validated.filter ? {
|
|
65
|
-
...validated.filter,
|
|
66
|
-
peerAddress: validated.filter.peerAddress ? normalizeAccountOrMark(validated.filter.peerAddress) : undefined,
|
|
67
|
-
} : undefined;
|
|
68
|
-
const messages = await watch_messages(filter);
|
|
69
|
-
result = { operation: "watch_messages", result: messages };
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
case "extract_zip_messages": {
|
|
73
|
-
const extractedPaths = await extract_zip_messages(validated.account, validated.messages, validated.outputDir);
|
|
74
|
-
result = { operation: "extract_zip_messages", result: extractedPaths };
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
case "generate_wts": {
|
|
78
|
-
const params = validated.params ? {
|
|
79
|
-
...validated.params,
|
|
80
|
-
peerAccount: normalizeAccountOrMark(validated.params.peerAccount),
|
|
81
|
-
} : undefined;
|
|
82
|
-
const wtsResult = await generate_wts(params);
|
|
83
|
-
result = { operation: "generate_wts", result: wtsResult };
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
case "verify_wts": {
|
|
87
|
-
const verifyResult = await verify_wts(validated.wtsFilePath);
|
|
88
|
-
result = { operation: "verify_wts", result: verifyResult };
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
case "sign_wts": {
|
|
92
|
-
const signedPath = await sign_wts(validated.wtsFilePath, validated.account, validated.outputPath);
|
|
93
|
-
result = { operation: "sign_wts", result: signedPath };
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
case "wts2html": {
|
|
97
|
-
const htmlResult = await wts2html(validated.wtsPath, validated.options);
|
|
98
|
-
result = { operation: "wts2html", result: htmlResult };
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
case "proof_message": {
|
|
102
|
-
const proofResult = await proof_message(validated.account, validated.messageId, validated.network);
|
|
103
|
-
result = { operation: "proof_message", result: proofResult };
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
case "blacklist": {
|
|
107
|
-
const blacklistParams = {
|
|
108
|
-
account: validated.account,
|
|
109
|
-
op: validated.blacklist.op,
|
|
110
|
-
};
|
|
111
|
-
if ('users' in validated.blacklist) {
|
|
112
|
-
blacklistParams.users = normalizeManyAccountOrMark(validated.blacklist.users);
|
|
113
|
-
}
|
|
114
|
-
const blacklistResult = await blacklist(blacklistParams);
|
|
115
|
-
result = { operation: "blacklist", op: validated.blacklist.op, result: blacklistResult.result };
|
|
116
|
-
break;
|
|
117
|
-
}
|
|
118
|
-
case "friendslist": {
|
|
119
|
-
const friendslistParams = {
|
|
120
|
-
account: validated.account,
|
|
121
|
-
op: validated.friendslist.op,
|
|
122
|
-
};
|
|
123
|
-
if ('users' in validated.friendslist) {
|
|
124
|
-
friendslistParams.users = normalizeManyAccountOrMark(validated.friendslist.users);
|
|
125
|
-
}
|
|
126
|
-
const friendslistResult = await friendslist(friendslistParams);
|
|
127
|
-
result = { operation: "friendslist", op: validated.friendslist.op, result: friendslistResult.result };
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
case "guardlist": {
|
|
131
|
-
const guardlistResult = await guardlist({
|
|
132
|
-
account: validated.account,
|
|
133
|
-
...validated.guardlist,
|
|
134
|
-
});
|
|
135
|
-
result = { operation: "guardlist", op: validated.guardlist.op, result: guardlistResult.result };
|
|
136
|
-
break;
|
|
137
|
-
}
|
|
138
|
-
case "settings": {
|
|
139
|
-
const settingsResult = await settings({
|
|
140
|
-
account: validated.account,
|
|
141
|
-
...validated.settings,
|
|
142
|
-
});
|
|
143
|
-
result = { operation: "settings", op: validated.settings.op, result: settingsResult.result };
|
|
144
|
-
break;
|
|
145
|
-
}
|
|
146
|
-
case "mark_messages_as_viewed": {
|
|
147
|
-
const markedCount = await mark_messages_as_viewed(validated.messageIds, validated.account);
|
|
148
|
-
result = { operation: "mark_messages_as_viewed", result: markedCount };
|
|
149
|
-
break;
|
|
150
|
-
}
|
|
151
|
-
case "mark_conversation_as_viewed": {
|
|
152
|
-
const markedCount = await mark_conversation_as_viewed(normalizeAccountOrMark(validated.peerAddress), validated.account);
|
|
153
|
-
result = { operation: "mark_conversation_as_viewed", result: markedCount };
|
|
154
|
-
break;
|
|
155
|
-
}
|
|
156
|
-
case "pull_messages": {
|
|
157
|
-
const messages = await pull_messages(validated.account, validated.limit);
|
|
158
|
-
result = { operation: "pull_messages", result: messages };
|
|
159
|
-
break;
|
|
160
|
-
}
|
|
161
|
-
default:
|
|
162
|
-
throw new Error(`Unknown messenger operation: ${opLiteral}`);
|
|
163
|
-
}
|
|
164
|
-
return {
|
|
165
|
-
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
166
|
-
structuredContent: { result },
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
catch (error) {
|
|
170
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
171
|
-
const ctx = validated ? { operation_type: "messenger_" + validated.operation, data: validated } : undefined;
|
|
172
|
-
const classified = classifyError(errorMessage);
|
|
173
|
-
const errorResult = { operation: "error", error: errorMessage };
|
|
174
|
-
if (classified.error_code !== undefined)
|
|
175
|
-
errorResult.error_code = classified.error_code;
|
|
176
|
-
if (classified.retryable !== undefined)
|
|
177
|
-
errorResult.retryable = classified.retryable;
|
|
178
|
-
if (classified.recovery_hint !== undefined)
|
|
179
|
-
errorResult.recovery_hint = classified.recovery_hint;
|
|
180
|
-
return {
|
|
181
|
-
content: [{ type: "text", text: `Error: ${errorMessage}` }],
|
|
182
|
-
structuredContent: {
|
|
183
|
-
result: errorResult,
|
|
184
|
-
semantic: buildDataSemantic(undefined, ctx, true, errorMessage),
|
|
185
|
-
},
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
}
|
|
1
|
+
import{strictParse,MessengerOperationInputSchema}from'../../schema/index.js';import{watch_conversations,send_message,send_file,watch_messages,extract_zip_messages,pull_messages,generate_wts,verify_wts,sign_wts,wts2html,proof_message,mark_messages_as_viewed,mark_conversation_as_viewed,blacklist,friendslist,guardlist,settings}from'@wowok/wowok';import{classifyError,buildDataSemantic}from'../../schema/call/semantic.js';export function normalizeAccountOrMark(a){if(typeof a==='string')return{'name_or_address':a,'local_mark_first':!![]};return a;}export function normalizeManyAccountOrMark(a){if(Array['isArray'](a))return{'entities':a['map'](b=>typeof b==='string'?{'name_or_address':b,'local_mark_first':!![]}:b),'check_all_founded':!![]};return a;}export async function handleMessengerOperation(a){let b;try{b=strictParse(MessengerOperationInputSchema,a,'messenger_operation\x20input');const c=b['operation'];let d;switch(b['operation']){case'watch_conversations':{const e=await watch_conversations(b['filter']);d={'operation':'watch_conversations','result':e};break;}case'send_message':{const f=await send_message(b['from'],normalizeAccountOrMark(b['to']),b['content'],b['options']),g={...f,'merkleData':f['merkleData']?{'leafIndex':f['merkleData']['leafIndex'],'prevRoot':f['merkleData']['prevRoot'],'newRoot':f['merkleData']['newRoot'],'serverSignature':f['merkleData']['serverSignature'],'serverTimestamp':f['merkleData']['serverTimestamp'],'serverPublicKey':f['merkleData']['serverPublicKey']}:undefined};d={'operation':'send_message','result':g};break;}case'send_file':{const h=await send_file(b['from'],normalizeAccountOrMark(b['to']),b['filePath'],b['options']),i={...h,'merkleData':h['merkleData']?{'leafIndex':h['merkleData']['leafIndex'],'prevRoot':h['merkleData']['prevRoot'],'newRoot':h['merkleData']['newRoot'],'serverSignature':h['merkleData']['serverSignature'],'serverTimestamp':h['merkleData']['serverTimestamp'],'serverPublicKey':h['merkleData']['serverPublicKey']}:undefined};d={'operation':'send_file','result':i};break;}case'watch_messages':{const j=b['filter']?{...b['filter'],'peerAddress':b['filter']['peerAddress']?normalizeAccountOrMark(b['filter']['peerAddress']):undefined}:undefined,k=await watch_messages(j);d={'operation':'watch_messages','result':k};break;}case'extract_zip_messages':{const l=await extract_zip_messages(b['account'],b['messages'],b['outputDir']);d={'operation':'extract_zip_messages','result':l};break;}case'generate_wts':{const m=b['params']?{...b['params'],'peerAccount':normalizeAccountOrMark(b['params']['peerAccount'])}:undefined,n=await generate_wts(m);d={'operation':'generate_wts','result':n};break;}case'verify_wts':{const o=await verify_wts(b['wtsFilePath']);d={'operation':'verify_wts','result':o};break;}case'sign_wts':{const p=await sign_wts(b['wtsFilePath'],b['account'],b['outputPath']);d={'operation':'sign_wts','result':p};break;}case'wts2html':{const q=await wts2html(b['wtsPath'],b['options']);d={'operation':'wts2html','result':q};break;}case'proof_message':{const r=await proof_message(b['account'],b['messageId'],b['network']);d={'operation':'proof_message','result':r};break;}case'blacklist':{const s={'account':b['account'],'op':b['blacklist']['op']};'users'in b['blacklist']&&(s['users']=normalizeManyAccountOrMark(b['blacklist']['users']));const t=await blacklist(s);d={'operation':'blacklist','op':b['blacklist']['op'],'result':t['result']};break;}case'friendslist':{const u={'account':b['account'],'op':b['friendslist']['op']};'users'in b['friendslist']&&(u['users']=normalizeManyAccountOrMark(b['friendslist']['users']));const v=await friendslist(u);d={'operation':'friendslist','op':b['friendslist']['op'],'result':v['result']};break;}case'guardlist':{const w=await guardlist({'account':b['account'],...b['guardlist']});d={'operation':'guardlist','op':b['guardlist']['op'],'result':w['result']};break;}case'settings':{const x=await settings({'account':b['account'],...b['settings']});d={'operation':'settings','op':b['settings']['op'],'result':x['result']};break;}case'mark_messages_as_viewed':{const y=await mark_messages_as_viewed(b['messageIds'],b['account']);d={'operation':'mark_messages_as_viewed','result':y};break;}case'mark_conversation_as_viewed':{const z=await mark_conversation_as_viewed(normalizeAccountOrMark(b['peerAddress']),b['account']);d={'operation':'mark_conversation_as_viewed','result':z};break;}case'pull_messages':{const A=await pull_messages(b['account'],b['limit']);d={'operation':'pull_messages','result':A};break;}default:throw new Error('Unknown\x20messenger\x20operation:\x20'+c);}return{'content':[{'type':'text','text':JSON['stringify'](d)}],'structuredContent':{'result':d}};}catch(B){const C=B instanceof Error?B['message']:String(B),D=b?{'operation_type':'messenger_'+b['operation'],'data':b}:undefined,E=classifyError(C),F={'operation':'error','error':C};if(E['error_code']!==undefined)F['error_code']=E['error_code'];if(E['retryable']!==undefined)F['retryable']=E['retryable'];if(E['recovery_hint']!==undefined)F['recovery_hint']=E['recovery_hint'];return{'content':[{'type':'text','text':'Error:\x20'+C}],'structuredContent':{'result':F,'semantic':buildDataSemantic(undefined,D,!![],C)}};}}
|