@wowok/agent-mcp 2.7.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.js +1 -1
- package/dist/config/runtime.js +1 -238
- package/dist/customer/account-events.d.ts +32 -0
- package/dist/customer/account-events.js +1 -0
- package/dist/customer/customer-advice.d.ts +1 -0
- package/dist/customer/customer-advice.js +1 -130
- package/dist/customer/index.js +1 -11
- package/dist/customer/industry-risks.js +1 -438
- package/dist/customer/info-puzzle.js +1 -681
- package/dist/customer/order-monitor.js +1 -328
- package/dist/customer/order-strategy.d.ts +1 -1
- package/dist/customer/order-strategy.js +1 -373
- package/dist/customer/post-purchase.js +1 -351
- package/dist/customer/preorder-compare.js +1 -34
- package/dist/customer/reminder-system.d.ts +2 -0
- package/dist/customer/reminder-system.js +1 -316
- package/dist/customer/risk-assessment.d.ts +1 -0
- package/dist/customer/risk-assessment.js +1 -397
- package/dist/customer/types.d.ts +2 -0
- package/dist/customer/types.js +1 -13
- package/dist/customer/user-preferences.js +1 -460
- package/dist/evaluation/arbitration-game.d.ts +9 -2
- package/dist/evaluation/arbitration-game.js +1 -48
- package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
- package/dist/evaluation/builtins/arbitration-score.js +1 -0
- package/dist/evaluation/builtins/demand-match.js +1 -153
- package/dist/evaluation/builtins/index.d.ts +1 -0
- package/dist/evaluation/builtins/index.js +1 -10
- package/dist/evaluation/builtins/service-risk.js +1 -55
- package/dist/evaluation/capability.js +1 -13
- package/dist/evaluation/category-match-rules.d.ts +30 -0
- package/dist/evaluation/category-match-rules.js +1 -0
- package/dist/evaluation/composer.js +1 -40
- package/dist/evaluation/engine.js +1 -175
- package/dist/evaluation/extract.js +1 -115
- package/dist/evaluation/game-strategy.d.ts +27 -0
- package/dist/evaluation/game-strategy.js +1 -0
- package/dist/evaluation/gap.js +1 -100
- package/dist/evaluation/index.d.ts +2 -0
- package/dist/evaluation/index.js +1 -11
- package/dist/evaluation/location-match.d.ts +42 -0
- package/dist/evaluation/location-match.js +1 -0
- package/dist/evaluation/node-game.d.ts +31 -3
- package/dist/evaluation/node-game.js +1 -57
- package/dist/evaluation/path-reasoning.d.ts +35 -0
- package/dist/evaluation/path-reasoning.js +1 -0
- package/dist/evaluation/region.d.ts +6 -0
- package/dist/evaluation/region.js +1 -36
- package/dist/evaluation/types.d.ts +18 -0
- package/dist/evaluation/types.js +1 -1
- package/dist/evaluation/user-injection.js +1 -27
- package/dist/experience/experience-reuse.js +1 -103
- package/dist/experience/index.js +1 -5
- package/dist/experience/intent-distill.js +1 -83
- package/dist/experience/realtime-feedback.js +1 -94
- package/dist/experience/types.js +1 -1
- package/dist/experience/user-profile.d.ts +1 -1
- package/dist/experience/user-profile.js +1 -171
- package/dist/extensions/business-modules.js +1 -287
- package/dist/extensions/capability-manifest.js +1 -781
- package/dist/extensions/constraint-registry.js +1 -198
- package/dist/extensions/index.d.ts +6 -0
- package/dist/extensions/index.js +1 -6
- package/dist/extensions/industry-layers.d.ts +75 -0
- package/dist/extensions/industry-layers.js +1 -0
- package/dist/extensions/industry-pack.d.ts +105 -0
- package/dist/extensions/industry-pack.js +1 -0
- package/dist/extensions/metric-registry.js +1 -257
- package/dist/extensions/mode-evaluator.d.ts +1 -1
- package/dist/extensions/mode-evaluator.js +1 -170
- package/dist/extensions/modes.js +1 -499
- package/dist/extensions/registry.d.ts +1 -0
- package/dist/extensions/registry.js +1 -717
- package/dist/extensions/types.js +1 -1
- package/dist/graph/base.d.ts +8 -0
- package/dist/graph/base.js +1 -0
- package/dist/harness/auto-escalation.js +1 -68
- package/dist/harness/checkpoint.js +1 -129
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/index.js +1 -78
- package/dist/harness/plan.d.ts +2 -0
- package/dist/harness/plan.js +1 -315
- package/dist/harness/recover.d.ts +1 -1
- package/dist/harness/recover.js +1 -139
- package/dist/harness/types.d.ts +2 -3
- package/dist/harness/types.js +1 -1
- package/dist/harness/verify.js +1 -237
- package/dist/index.js +1 -273
- package/dist/intent/enrich.js +1 -67
- package/dist/intent/index.js +1 -60
- package/dist/intent/matcher.js +1 -81
- package/dist/intent/store.js +1 -55
- package/dist/intent/types.js +1 -10
- package/dist/knowledge/acquisition-flywheel.js +1 -192
- package/dist/knowledge/allocation-confirm.js +1 -534
- package/dist/knowledge/allocation-context.js +1 -249
- package/dist/knowledge/allocation-ledger.js +1 -463
- package/dist/knowledge/allocation-puzzle.js +1 -298
- package/dist/knowledge/allocation-risk.js +1 -568
- package/dist/knowledge/allocation-templates.js +1 -970
- package/dist/knowledge/allocation-translation.js +1 -585
- package/dist/knowledge/anti-cheat.d.ts +37 -0
- package/dist/knowledge/anti-cheat.js +1 -0
- package/dist/knowledge/arb-confirm.d.ts +28 -0
- package/dist/knowledge/arb-confirm.js +1 -0
- package/dist/knowledge/arb-risk.js +1 -210
- package/dist/knowledge/arb-translation.d.ts +48 -0
- package/dist/knowledge/arb-translation.js +1 -0
- package/dist/knowledge/arbitration-confirm.js +1 -559
- package/dist/knowledge/arbitration-context.js +1 -505
- package/dist/knowledge/arbitration-ledger.js +1 -521
- package/dist/knowledge/arbitration-puzzle.js +1 -304
- package/dist/knowledge/arbitration-risk.js +1 -423
- package/dist/knowledge/arbitration-templates.js +1 -276
- package/dist/knowledge/arbitration-translation.js +1 -487
- package/dist/knowledge/audit-rules.js +1 -141
- package/dist/knowledge/bridge-confirm.d.ts +26 -0
- package/dist/knowledge/bridge-confirm.js +1 -0
- package/dist/knowledge/bridge-risk.js +1 -263
- package/dist/knowledge/bridge-translation.d.ts +37 -0
- package/dist/knowledge/bridge-translation.js +1 -0
- package/dist/knowledge/contact-confirm.d.ts +27 -0
- package/dist/knowledge/contact-confirm.js +1 -0
- package/dist/knowledge/contact-risk.js +1 -200
- package/dist/knowledge/contact-templates.js +1 -60
- package/dist/knowledge/contact-translation.d.ts +39 -0
- package/dist/knowledge/contact-translation.js +1 -0
- package/dist/knowledge/demand-confirm.js +1 -206
- package/dist/knowledge/demand-context.d.ts +17 -0
- package/dist/knowledge/demand-context.js +1 -0
- package/dist/knowledge/demand-ledger.d.ts +26 -0
- package/dist/knowledge/demand-ledger.js +1 -0
- package/dist/knowledge/demand-matching.js +1 -132
- package/dist/knowledge/demand-puzzle.d.ts +29 -0
- package/dist/knowledge/demand-puzzle.js +1 -0
- package/dist/knowledge/demand-risk.js +1 -240
- package/dist/knowledge/demand-templates.d.ts +12 -0
- package/dist/knowledge/demand-templates.js +1 -0
- package/dist/knowledge/demand-translation.js +1 -354
- package/dist/knowledge/deployment-scanner.js +1 -823
- package/dist/knowledge/dynamic-pricing.js +1 -87
- package/dist/knowledge/evidence-review.d.ts +12 -0
- package/dist/knowledge/evidence-review.js +1 -0
- package/dist/knowledge/examples-scanner-cli.js +1 -26
- package/dist/knowledge/examples-scanner.js +1 -843
- package/dist/knowledge/flywheel-loop.d.ts +0 -1
- package/dist/knowledge/flywheel-loop.js +1 -404
- package/dist/knowledge/fund-layer.js +1 -973
- package/dist/knowledge/glossary.js +1 -211
- package/dist/knowledge/guard-confirm.js +1 -406
- package/dist/knowledge/guard-context.js +1 -287
- package/dist/knowledge/guard-design-patterns.js +1 -360
- package/dist/knowledge/guard-ledger.js +1 -260
- package/dist/knowledge/guard-lint.js +1 -670
- package/dist/knowledge/guard-migration.d.ts +1 -1
- package/dist/knowledge/guard-migration.js +1 -228
- package/dist/knowledge/guard-puzzle.js +1 -805
- package/dist/knowledge/guard-render.js +1 -700
- package/dist/knowledge/guard-risk.js +1 -1879
- package/dist/knowledge/guard-submission-prompt.js +1 -171
- package/dist/knowledge/guard-templates.js +1 -1105
- package/dist/knowledge/guard-translation.js +1 -1119
- package/dist/knowledge/index.d.ts +71 -3
- package/dist/knowledge/index.js +1 -436
- package/dist/knowledge/industry-evolution.js +1 -323
- package/dist/knowledge/industry-generalizer.js +1 -381
- package/dist/knowledge/industry-registry.js +1 -174
- package/dist/knowledge/intent-metrics.d.ts +4 -3
- package/dist/knowledge/intent-metrics.js +1 -566
- package/dist/knowledge/machine-confirm.js +1 -559
- package/dist/knowledge/machine-context.js +1 -833
- package/dist/knowledge/machine-ledger.js +1 -338
- package/dist/knowledge/machine-puzzle.js +1 -494
- package/dist/knowledge/machine-render.js +1 -565
- package/dist/knowledge/machine-risk.js +1 -669
- package/dist/knowledge/machine-templates.js +1 -1597
- package/dist/knowledge/machine-topology.js +1 -234
- package/dist/knowledge/machine-translation.js +1 -513
- package/dist/knowledge/market-metrics.d.ts +12 -0
- package/dist/knowledge/market-metrics.js +1 -0
- package/dist/knowledge/market-operations.d.ts +46 -0
- package/dist/knowledge/market-operations.js +1 -0
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
- package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
- package/dist/knowledge/mcp-schema-audit.js +1 -777
- package/dist/knowledge/onchain-constants.js +1 -35
- package/dist/knowledge/order-confirm.js +1 -573
- package/dist/knowledge/order-context.js +1 -390
- package/dist/knowledge/order-ledger.js +1 -341
- package/dist/knowledge/order-puzzle.js +1 -255
- package/dist/knowledge/order-risk.js +1 -653
- package/dist/knowledge/order-templates.js +1 -368
- package/dist/knowledge/order-translation.js +1 -550
- package/dist/knowledge/overrides-loader.js +1 -65
- package/dist/knowledge/passport-confirm.js +1 -531
- package/dist/knowledge/passport-context.js +1 -306
- package/dist/knowledge/passport-ledger.js +1 -282
- package/dist/knowledge/passport-puzzle.js +1 -333
- package/dist/knowledge/passport-risk.js +1 -450
- package/dist/knowledge/passport-templates.js +1 -568
- package/dist/knowledge/passport-translation.js +1 -516
- package/dist/knowledge/payment-confirm.d.ts +26 -0
- package/dist/knowledge/payment-confirm.js +1 -0
- package/dist/knowledge/payment-risk.js +1 -249
- package/dist/knowledge/payment-translation.d.ts +37 -0
- package/dist/knowledge/payment-translation.js +1 -0
- package/dist/knowledge/permission-confirm.js +1 -426
- package/dist/knowledge/permission-context.js +1 -224
- package/dist/knowledge/permission-ledger.d.ts +11 -0
- package/dist/knowledge/permission-ledger.js +1 -403
- package/dist/knowledge/permission-puzzle.js +1 -173
- package/dist/knowledge/permission-risk.js +1 -411
- package/dist/knowledge/permission-templates.js +1 -234
- package/dist/knowledge/permission-translation.js +1 -350
- package/dist/knowledge/personal-confirm.d.ts +29 -0
- package/dist/knowledge/personal-confirm.js +1 -0
- package/dist/knowledge/personal-risk.js +1 -212
- package/dist/knowledge/personal-translation.d.ts +37 -0
- package/dist/knowledge/personal-translation.js +1 -0
- package/dist/knowledge/process-model.d.ts +1 -11
- package/dist/knowledge/process-model.js +1 -160
- package/dist/knowledge/progress-confirm.js +1 -456
- package/dist/knowledge/progress-context.js +1 -452
- package/dist/knowledge/progress-ledger.js +1 -330
- package/dist/knowledge/progress-puzzle.js +1 -219
- package/dist/knowledge/progress-risk.js +1 -461
- package/dist/knowledge/progress-templates.js +1 -228
- package/dist/knowledge/progress-translation.js +1 -405
- package/dist/knowledge/proof-confirm.js +1 -187
- package/dist/knowledge/proof-context.d.ts +17 -0
- package/dist/knowledge/proof-context.js +1 -0
- package/dist/knowledge/proof-ledger.d.ts +34 -0
- package/dist/knowledge/proof-ledger.js +1 -0
- package/dist/knowledge/proof-puzzle.d.ts +35 -0
- package/dist/knowledge/proof-puzzle.js +1 -0
- package/dist/knowledge/proof-risk.js +1 -207
- package/dist/knowledge/proof-templates.d.ts +22 -0
- package/dist/knowledge/proof-templates.js +1 -0
- package/dist/knowledge/proof-translation.js +1 -283
- package/dist/knowledge/registrar-confirm.d.ts +26 -0
- package/dist/knowledge/registrar-confirm.js +1 -0
- package/dist/knowledge/registrar-risk.js +1 -217
- package/dist/knowledge/registrar-translation.d.ts +37 -0
- package/dist/knowledge/registrar-translation.js +1 -0
- package/dist/knowledge/repository-confirm.js +1 -286
- package/dist/knowledge/repository-context.d.ts +12 -0
- package/dist/knowledge/repository-context.js +1 -0
- package/dist/knowledge/repository-ledger.d.ts +25 -0
- package/dist/knowledge/repository-ledger.js +1 -0
- package/dist/knowledge/repository-puzzle.d.ts +30 -0
- package/dist/knowledge/repository-puzzle.js +1 -0
- package/dist/knowledge/repository-risk.js +1 -373
- package/dist/knowledge/repository-templates.d.ts +14 -0
- package/dist/knowledge/repository-templates.js +1 -0
- package/dist/knowledge/repository-translation.js +1 -445
- package/dist/knowledge/reputation-rules.js +1 -99
- package/dist/knowledge/resource-confirm.d.ts +25 -0
- package/dist/knowledge/resource-confirm.js +1 -0
- package/dist/knowledge/resource-risk.js +1 -157
- package/dist/knowledge/resource-translation.d.ts +37 -0
- package/dist/knowledge/resource-translation.js +1 -0
- package/dist/knowledge/reward-confirm.js +1 -526
- package/dist/knowledge/reward-context.d.ts +2 -2
- package/dist/knowledge/reward-context.js +1 -504
- package/dist/knowledge/reward-ledger.js +1 -502
- package/dist/knowledge/reward-puzzle.js +1 -300
- package/dist/knowledge/reward-risk.js +1 -627
- package/dist/knowledge/reward-templates.js +1 -197
- package/dist/knowledge/reward-translation.js +1 -501
- package/dist/knowledge/safety-rules.d.ts +1 -0
- package/dist/knowledge/safety-rules.js +1 -404
- package/dist/knowledge/scenario-modes.js +1 -321
- package/dist/knowledge/service-confirm.js +1 -807
- package/dist/knowledge/service-context.js +1 -403
- package/dist/knowledge/service-ledger.js +1 -609
- package/dist/knowledge/service-puzzle.js +1 -236
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +1 -651
- package/dist/knowledge/service-templates.js +1 -456
- package/dist/knowledge/service-translation.js +1 -622
- package/dist/knowledge/template-registry.js +1 -353
- package/dist/knowledge/tool-constraints.js +1 -195
- package/dist/knowledge/tools-reference.js +1 -178
- package/dist/knowledge/treasury-confirm.js +1 -512
- package/dist/knowledge/treasury-context.js +1 -363
- package/dist/knowledge/treasury-ledger.js +1 -300
- package/dist/knowledge/treasury-puzzle.js +1 -216
- package/dist/knowledge/treasury-risk.js +1 -440
- package/dist/knowledge/treasury-templates.js +1 -358
- package/dist/knowledge/treasury-translation.js +1 -498
- package/dist/knowledge/trust-metrics.js +1 -198
- package/dist/knowledge/universal-template.d.ts +22 -0
- package/dist/knowledge/universal-template.js +1 -0
- package/dist/knowledge/util-confirm.d.ts +24 -0
- package/dist/knowledge/util-confirm.js +1 -0
- package/dist/knowledge/util-risk.js +1 -135
- package/dist/knowledge/util-translation.d.ts +38 -0
- package/dist/knowledge/util-translation.js +1 -0
- package/dist/knowledge/workflow-guidance.d.ts +116 -0
- package/dist/knowledge/workflow-guidance.js +1 -0
- package/dist/loop-engineering/aggregate.js +1 -132
- package/dist/loop-engineering/context-collect.js +1 -83
- package/dist/loop-engineering/diagnose.js +1 -273
- package/dist/loop-engineering/improve.js +1 -405
- package/dist/loop-engineering/index.js +1 -4
- package/dist/loop-engineering/pipeline.js +1 -56
- package/dist/mode-market/index.js +1 -3
- package/dist/mode-market/registry.js +1 -124
- package/dist/mode-market/review.js +1 -214
- package/dist/mode-market/submission.js +1 -85
- package/dist/participation/collaborator-interest.d.ts +23 -0
- package/dist/participation/collaborator-interest.js +1 -0
- package/dist/participation/customer-interest.d.ts +25 -0
- package/dist/participation/customer-interest.js +1 -0
- package/dist/participation/employee-kpi.d.ts +25 -0
- package/dist/participation/employee-kpi.js +1 -0
- package/dist/participation/employee-store.d.ts +16 -0
- package/dist/participation/employee-store.js +1 -0
- package/dist/participation/index.d.ts +2 -0
- package/dist/participation/index.js +1 -0
- package/dist/participation/merchant-interest.js +1 -100
- package/dist/participation/radar-core.d.ts +13 -3
- package/dist/participation/radar-core.js +1 -269
- package/dist/participation/supplier-interest.d.ts +25 -0
- package/dist/participation/supplier-interest.js +1 -0
- package/dist/persona/analyzer.js +1 -66
- package/dist/persona/bridge.js +1 -86
- package/dist/persona/defaults.js +1 -195
- package/dist/persona/experience-bridge.js +1 -23
- package/dist/persona/index.d.ts +9 -2
- package/dist/persona/index.js +1 -71
- package/dist/persona/local-region.d.ts +20 -0
- package/dist/persona/local-region.js +1 -0
- package/dist/persona/model.js +1 -111
- package/dist/persona/overrides.d.ts +10 -0
- package/dist/persona/overrides.js +1 -0
- package/dist/persona/pack-personae.d.ts +11 -0
- package/dist/persona/pack-personae.js +1 -0
- package/dist/persona/store.js +1 -62
- package/dist/persona/strategy-intent.d.ts +20 -0
- package/dist/persona/strategy-intent.js +1 -0
- package/dist/persona/types.d.ts +6 -2
- package/dist/persona/types.js +1 -5
- package/dist/project/business-puzzle.d.ts +1 -1
- package/dist/project/business-puzzle.js +1 -383
- package/dist/project/context-assembly.js +1 -254
- package/dist/project/deployment-bridge.js +1 -120
- package/dist/project/deployment-doc.js +1 -1126
- package/dist/project/edit-planner.js +1 -1342
- package/dist/project/evaluation.d.ts +37 -1
- package/dist/project/evaluation.js +1 -2011
- package/dist/project/game-theory.js +1 -177
- package/dist/project/graph-builder.js +1 -656
- package/dist/project/graph.d.ts +3 -6
- package/dist/project/graph.js +1 -340
- package/dist/project/handlers.d.ts +33 -2
- package/dist/project/handlers.js +1 -1784
- package/dist/project/index.d.ts +2 -0
- package/dist/project/index.js +1 -301
- package/dist/project/intent-analyzer.js +1 -149
- package/dist/project/machine-nodes.js +1 -36
- package/dist/project/merchant-guide.d.ts +19 -0
- package/dist/project/merchant-guide.js +1 -264
- package/dist/project/migration.js +1 -125
- package/dist/project/mode-actions.js +1 -309
- package/dist/project/namespace.js +1 -206
- package/dist/project/participation-radar.js +1 -428
- package/dist/project/pipeline-actions.js +1 -109
- package/dist/project/project-store.js +1 -422
- package/dist/project/query.js +1 -153
- package/dist/project/reverse-mapping.d.ts +34 -0
- package/dist/project/reverse-mapping.js +1 -0
- package/dist/project/risk-aggregator.js +1 -295
- package/dist/project/rollback-policy.js +1 -290
- package/dist/project/semantic-assembler.js +1 -345
- package/dist/project/semantic-graph.d.ts +3 -5
- package/dist/project/semantic-graph.js +1 -292
- package/dist/project/stage-gate.js +1 -369
- package/dist/project/substep-trace.js +1 -332
- package/dist/project/task-tracker.js +1 -78
- package/dist/project/workflow-design-assessment.d.ts +24 -0
- package/dist/project/workflow-design-assessment.js +1 -0
- package/dist/role/derivation.d.ts +18 -0
- package/dist/role/derivation.js +1 -0
- package/dist/role/index.d.ts +5 -0
- package/dist/role/index.js +1 -0
- package/dist/role/model.d.ts +8 -0
- package/dist/role/model.js +1 -0
- package/dist/role/resolution.d.ts +11 -0
- package/dist/role/resolution.js +1 -0
- package/dist/role/types.d.ts +11 -0
- package/dist/role/types.js +1 -0
- package/dist/rules.js +1 -52
- package/dist/safety/confirm-gate.d.ts +1 -1
- package/dist/safety/confirm-gate.js +1 -88
- package/dist/safety/index.js +1 -3
- package/dist/safety/preview.js +1 -52
- package/dist/schema/call/allocation.d.ts +186 -1385
- package/dist/schema/call/allocation.js +1 -34
- package/dist/schema/call/arbitration.d.ts +272 -1871
- package/dist/schema/call/arbitration.js +1 -113
- package/dist/schema/call/base.d.ts +1831 -9076
- package/dist/schema/call/base.js +1 -370
- package/dist/schema/call/bridge.d.ts +911 -3171
- package/dist/schema/call/bridge.js +1 -458
- package/dist/schema/call/contact.d.ts +135 -931
- package/dist/schema/call/contact.js +1 -37
- package/dist/schema/call/demand.d.ts +164 -1194
- package/dist/schema/call/demand.js +1 -47
- package/dist/schema/call/guard.d.ts +298 -1140
- package/dist/schema/call/guard.js +1 -161
- package/dist/schema/call/handler.js +1 -322
- package/dist/schema/call/index.js +1 -20
- package/dist/schema/call/machine.d.ts +459 -5403
- package/dist/schema/call/machine.js +1 -193
- package/dist/schema/call/order.d.ts +137 -844
- package/dist/schema/call/order.js +1 -35
- package/dist/schema/call/payment.d.ts +74 -561
- package/dist/schema/call/payment.js +1 -37
- package/dist/schema/call/permission-handler.js +1 -54
- package/dist/schema/call/permission.d.ts +335 -2791
- package/dist/schema/call/permission.js +1 -105
- package/dist/schema/call/personal.d.ts +227 -1814
- package/dist/schema/call/personal.js +1 -78
- package/dist/schema/call/progress.d.ts +140 -843
- package/dist/schema/call/progress.js +1 -47
- package/dist/schema/call/proof.d.ts +42 -258
- package/dist/schema/call/proof.js +1 -33
- package/dist/schema/call/repository.d.ts +324 -2222
- package/dist/schema/call/repository.js +1 -77
- package/dist/schema/call/reward.d.ts +153 -1183
- package/dist/schema/call/reward.js +1 -30
- package/dist/schema/call/semantic.js +1 -1679
- package/dist/schema/call/service.d.ts +376 -3431
- package/dist/schema/call/service.js +1 -184
- package/dist/schema/call/treasury.d.ts +252 -2158
- package/dist/schema/call/treasury.js +1 -71
- package/dist/schema/common/index.d.ts +222 -697
- package/dist/schema/common/index.js +1 -407
- package/dist/schema/config/index.d.ts +18 -161
- package/dist/schema/config/index.js +1 -68
- package/dist/schema/employee/index.d.ts +99 -0
- package/dist/schema/employee/index.js +1 -0
- package/dist/schema/evaluation/index.d.ts +1062 -3748
- package/dist/schema/evaluation/index.js +1 -356
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.js +1 -17
- package/dist/schema/industry-pack/index.d.ts +132 -0
- package/dist/schema/industry-pack/index.js +1 -0
- package/dist/schema/intent-radar/index.d.ts +92 -245
- package/dist/schema/intent-radar/index.js +1 -89
- package/dist/schema/local/index.d.ts +2045 -18080
- package/dist/schema/local/index.js +1 -927
- package/dist/schema/local/wip.d.ts +61 -651
- package/dist/schema/local/wip.js +1 -187
- package/dist/schema/messenger/index.d.ts +949 -5557
- package/dist/schema/messenger/index.js +1 -475
- package/dist/schema/operations.d.ts +2969 -26518
- package/dist/schema/operations.js +1 -520
- package/dist/schema/persona/index.d.ts +469 -1820
- package/dist/schema/persona/index.js +1 -148
- package/dist/schema/project/index.d.ts +1027 -8408
- package/dist/schema/project/index.js +1 -2057
- package/dist/schema/query/index.d.ts +12041 -75261
- package/dist/schema/query/index.js +1 -1646
- package/dist/schema/schema-query/index.d.ts +35 -98
- package/dist/schema/schema-query/index.js +1 -104
- package/dist/schema/schema-version.js +1 -76
- package/dist/schema/task-status.d.ts +26 -132
- package/dist/schema/task-status.js +1 -36
- package/dist/schema/trust/index.d.ts +194 -1290
- package/dist/schema/trust/index.js +1 -314
- package/dist/schema/utils/guard-parser.js +1 -419
- package/dist/schema/utils/guard-query-utils.js +1 -46
- package/dist/schema/utils/node-parser.js +1 -369
- package/dist/schema/utils/object-type-utils.js +1 -35
- package/dist/schema/utils/permission-index-utils.js +1 -7
- package/dist/schema/utils/permission-machine-check.js +1 -121
- package/dist/schema/utils/skills-recommendation.d.ts +1 -0
- package/dist/schema/utils/skills-recommendation.js +1 -77
- package/dist/schema/workspace/index.d.ts +69 -0
- package/dist/schema/workspace/index.js +1 -0
- package/dist/schema-query-impl/index.js +1 -0
- package/dist/schemas/account_operation.output.json +3147 -1652
- package/dist/schemas/account_operation.schema.json +225 -218
- package/dist/schemas/bridge_operation.output.json +1168 -650
- package/dist/schemas/bridge_operation.schema.json +736 -504
- package/dist/schemas/config_operation.output.json +185 -179
- package/dist/schemas/config_operation.schema.json +21 -26
- package/dist/schemas/employee_operation.output.json +207 -0
- package/dist/schemas/employee_operation.schema.json +176 -0
- package/dist/schemas/evaluation_operation.output.json +2329 -557
- package/dist/schemas/evaluation_operation.schema.json +2939 -720
- package/dist/schemas/guard2file.output.json +58 -64
- package/dist/schemas/guard2file.schema.json +79 -81
- package/dist/schemas/index.json +29 -11
- package/dist/schemas/industry_pack_operation.output.json +594 -0
- package/dist/schemas/industry_pack_operation.schema.json +55 -0
- package/dist/schemas/intent_radar.output.json +275 -200
- package/dist/schemas/intent_radar.schema.json +124 -123
- package/dist/schemas/local_info_operation.output.json +1174 -657
- package/dist/schemas/local_info_operation.schema.json +119 -125
- package/dist/schemas/local_mark_operation.output.json +1239 -689
- package/dist/schemas/local_mark_operation.schema.json +91 -96
- package/dist/schemas/machineNode2file.output.json +63 -69
- package/dist/schemas/machineNode2file.schema.json +79 -81
- package/dist/schemas/messenger_operation.output.json +2722 -1528
- package/dist/schemas/messenger_operation.schema.json +1482 -1264
- package/dist/schemas/onchain_events.output.json +2590 -975
- package/dist/schemas/onchain_events.schema.json +117 -99
- package/dist/schemas/onchain_operations.output.json +3957 -2309
- package/dist/schemas/onchain_operations.schema.json +20799 -9285
- package/dist/schemas/onchain_operations_allocation.schema.json +172 -108
- package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
- package/dist/schemas/onchain_operations_contact.schema.json +129 -90
- package/dist/schemas/onchain_operations_demand.schema.json +170 -112
- package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
- package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
- package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
- package/dist/schemas/onchain_operations_machine.schema.json +537 -164
- package/dist/schemas/onchain_operations_order.schema.json +126 -96
- package/dist/schemas/onchain_operations_payment.schema.json +82 -67
- package/dist/schemas/onchain_operations_permission.schema.json +331 -93
- package/dist/schemas/onchain_operations_personal.schema.json +636 -96
- package/dist/schemas/onchain_operations_progress.schema.json +125 -92
- package/dist/schemas/onchain_operations_proof.schema.json +76 -69
- package/dist/schemas/onchain_operations_repository.schema.json +636 -249
- package/dist/schemas/onchain_operations_reward.schema.json +218 -108
- package/dist/schemas/onchain_operations_service.schema.json +679 -221
- package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
- package/dist/schemas/onchain_table_data.output.json +6018 -2430
- package/dist/schemas/onchain_table_data.schema.json +544 -430
- package/dist/schemas/persona_operation.output.json +1568 -265
- package/dist/schemas/persona_operation.schema.json +346 -202
- package/dist/schemas/project_operation.output.json +6957 -5147
- package/dist/schemas/project_operation.schema.json +1050 -1020
- package/dist/schemas/query_task_status.output.json +195 -99
- package/dist/schemas/query_task_status.schema.json +12 -18
- package/dist/schemas/query_toolkit.output.json +18870 -14566
- package/dist/schemas/query_toolkit.schema.json +614 -522
- package/dist/schemas/schema_query.output.json +127 -129
- package/dist/schemas/schema_query.schema.json +64 -69
- package/dist/schemas/trust_score.output.json +678 -587
- package/dist/schemas/trust_score.schema.json +289 -277
- package/dist/schemas/wip_file.output.json +116 -124
- package/dist/schemas/wip_file.schema.json +142 -143
- package/dist/schemas/workspace_operation.output.json +277 -0
- package/dist/schemas/workspace_operation.schema.json +45 -0
- package/dist/schemas/wowok_buildin_info.output.json +1693 -723
- package/dist/schemas/wowok_buildin_info.schema.json +576 -512
- package/dist/telemetry/index.js +1 -112
- package/dist/telemetry/redact.js +1 -23
- package/dist/telemetry/storage.js +1 -80
- package/dist/tools/handlers/bridge.d.ts +8 -1
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -74
- package/dist/tools/handlers/employee.d.ts +2 -0
- package/dist/tools/handlers/employee.js +1 -0
- package/dist/tools/handlers/evaluation.js +1 -123
- package/dist/tools/handlers/file-export.js +1 -90
- package/dist/tools/handlers/industry-pack.d.ts +2 -0
- package/dist/tools/handlers/industry-pack.js +1 -0
- package/dist/tools/handlers/intent-radar.js +1 -76
- package/dist/tools/handlers/local.js +1 -53
- package/dist/tools/handlers/messenger.js +1 -188
- package/dist/tools/handlers/onchain.js +1 -1180
- package/dist/tools/handlers/persona.js +1 -89
- package/dist/tools/handlers/project.js +1 -211
- package/dist/tools/handlers/query.js +1 -434
- package/dist/tools/handlers/schema-query.js +1 -176
- package/dist/tools/handlers/task-status.js +1 -26
- package/dist/tools/handlers/trust.js +1 -380
- package/dist/tools/handlers/wip.js +1 -90
- package/dist/tools/handlers/workspace.d.ts +2 -0
- package/dist/tools/handlers/workspace.js +1 -0
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +1 -1382
- package/dist/tools/retry.js +1 -85
- package/dist/tools/rules-hook.d.ts +1 -1
- package/dist/tools/rules-hook.js +1 -23
- package/dist/tools/shared.d.ts +1 -1
- package/dist/tools/shared.js +1 -130
- package/dist/tools/types.d.ts +2 -1
- package/dist/tools/types.js +1 -1
- package/dist/tools/upgrade-check.d.ts +19 -0
- package/dist/tools/upgrade-check.js +1 -0
- package/dist/tools/wip-deploy-assist.js +1 -306
- package/dist/tools/wrap.js +1 -500
- package/package.json +7 -6
- package/dist/knowledge/arbitration-trust.d.ts +0 -24
- package/dist/knowledge/arbitration-trust.js +0 -117
- package/dist/schema/call/bridge-handler.d.ts +0 -8
- package/dist/schema/call/bridge-handler.js +0 -265
- package/dist/schema/sync-layer4.d.ts +0 -21
- package/dist/schema/sync-layer4.js +0 -286
- package/dist/schema-query/index.js +0 -810
- /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
|
@@ -1,428 +1 @@
|
|
|
1
|
-
import { LocalMark, query_objects, query_table, watch_conversations, } from "@wowok/wowok";
|
|
2
|
-
import { analyzeOrderParticipation, aggregateRadar, isConsequenceNode, } from "../participation/radar-core.js";
|
|
3
|
-
import { monitorOrder } from "../customer/order-monitor.js";
|
|
4
|
-
import { analyzeMerchantInterest } from "../participation/merchant-interest.js";
|
|
5
|
-
import { fetchMachineNodes } from "./machine-nodes.js";
|
|
6
|
-
import { extractGenericTokenType, registryDisplayHint } from "../knowledge/fund-layer.js";
|
|
7
|
-
const QUERY_BATCH = 50;
|
|
8
|
-
function fld(obj, key) {
|
|
9
|
-
return (obj?.[key] ?? obj?.data?.[key]);
|
|
10
|
-
}
|
|
11
|
-
async function resolveAddress(nameOrAddress, what) {
|
|
12
|
-
const addr = await LocalMark.Instance().get_address(nameOrAddress);
|
|
13
|
-
if (!addr) {
|
|
14
|
-
throw new Error(`Cannot resolve ${what} '${nameOrAddress}' — not a valid address and no LocalMark entry found. ` +
|
|
15
|
-
`Register it via local_mark_operation or pass the 0x address directly.`);
|
|
16
|
-
}
|
|
17
|
-
return addr;
|
|
18
|
-
}
|
|
19
|
-
function balanceStr(v) {
|
|
20
|
-
if (v == null)
|
|
21
|
-
return undefined;
|
|
22
|
-
if (typeof v === "object" && "balance" in v)
|
|
23
|
-
return String(v.balance);
|
|
24
|
-
return String(v);
|
|
25
|
-
}
|
|
26
|
-
function balanceToken(v) {
|
|
27
|
-
if (v != null && typeof v === "object" && typeof v.token_type === "string") {
|
|
28
|
-
return v.token_type;
|
|
29
|
-
}
|
|
30
|
-
return undefined;
|
|
31
|
-
}
|
|
32
|
-
function summarizeAllocation(raw, account) {
|
|
33
|
-
const list = Array.isArray(raw)
|
|
34
|
-
? raw
|
|
35
|
-
: Array.isArray(raw?.allocators)
|
|
36
|
-
? raw.allocators
|
|
37
|
-
: [];
|
|
38
|
-
if (list.length === 0)
|
|
39
|
-
return undefined;
|
|
40
|
-
let recipient_slots = 0;
|
|
41
|
-
let guard_gated_slots = 0;
|
|
42
|
-
let direct_to_me_slots = 0;
|
|
43
|
-
let to_payer_slots = 0;
|
|
44
|
-
const me = account.toLowerCase();
|
|
45
|
-
for (const allocator of list) {
|
|
46
|
-
for (const s of allocator?.sharing ?? []) {
|
|
47
|
-
recipient_slots++;
|
|
48
|
-
const who = s?.who;
|
|
49
|
-
if (who == null)
|
|
50
|
-
continue;
|
|
51
|
-
if (typeof who === "object" && "GuardIdentifier" in who)
|
|
52
|
-
guard_gated_slots++;
|
|
53
|
-
else if (typeof who === "object" && "Signer" in who)
|
|
54
|
-
to_payer_slots++;
|
|
55
|
-
else if (typeof who === "object" && "Entity" in who) {
|
|
56
|
-
const entity = who.Entity;
|
|
57
|
-
const addr = typeof entity === "string" ? entity : entity?.name_or_address;
|
|
58
|
-
if (typeof addr === "string" && addr.toLowerCase() === me)
|
|
59
|
-
direct_to_me_slots++;
|
|
60
|
-
}
|
|
61
|
-
else if (typeof who === "string" && who.toLowerCase() === me) {
|
|
62
|
-
direct_to_me_slots++;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
return { recipient_slots, guard_gated_slots, direct_to_me_slots, to_payer_slots };
|
|
67
|
-
}
|
|
68
|
-
async function queryObjectsBatched(addresses, network) {
|
|
69
|
-
const out = [];
|
|
70
|
-
for (let i = 0; i < addresses.length; i += QUERY_BATCH) {
|
|
71
|
-
const batch = addresses.slice(i, i + QUERY_BATCH);
|
|
72
|
-
const res = await query_objects({ objects: batch, network });
|
|
73
|
-
out.push(...(res?.objects ?? []));
|
|
74
|
-
}
|
|
75
|
-
return out;
|
|
76
|
-
}
|
|
77
|
-
async function fetchEntityPermissions(permissionAddress, network) {
|
|
78
|
-
const map = new Map();
|
|
79
|
-
const fieldIds = [];
|
|
80
|
-
let cursor = undefined;
|
|
81
|
-
for (;;) {
|
|
82
|
-
const tableResult = await query_table({
|
|
83
|
-
parent: permissionAddress,
|
|
84
|
-
cursor: cursor ?? undefined,
|
|
85
|
-
network,
|
|
86
|
-
});
|
|
87
|
-
if (!tableResult?.items || tableResult.items.length === 0)
|
|
88
|
-
break;
|
|
89
|
-
for (const item of tableResult.items) {
|
|
90
|
-
if (item.object)
|
|
91
|
-
fieldIds.push(item.object);
|
|
92
|
-
}
|
|
93
|
-
if (!tableResult.hasNextPage || !tableResult.nextCursor)
|
|
94
|
-
break;
|
|
95
|
-
cursor = tableResult.nextCursor;
|
|
96
|
-
}
|
|
97
|
-
const items = (await queryObjectsBatched(fieldIds, network));
|
|
98
|
-
for (const item of items) {
|
|
99
|
-
if (item?.type !== "TableItem_PermissionPerm")
|
|
100
|
-
continue;
|
|
101
|
-
const entity = fld(item, "address");
|
|
102
|
-
const permRaw = fld(item, "perm") ?? [];
|
|
103
|
-
const indexes = permRaw
|
|
104
|
-
.map(p => (typeof p === "number" ? p : typeof p?.index === "number" ? p.index : null))
|
|
105
|
-
.filter((p) => p !== null);
|
|
106
|
-
if (entity)
|
|
107
|
-
map.set(entity, indexes);
|
|
108
|
-
}
|
|
109
|
-
return map;
|
|
110
|
-
}
|
|
111
|
-
function toRadarMachineNodes(raw) {
|
|
112
|
-
return raw.map(n => ({
|
|
113
|
-
name: n.name,
|
|
114
|
-
pairs: (Array.isArray(n.value) ? n.value : []).map(pair => ({
|
|
115
|
-
prev_node: pair.prev_node,
|
|
116
|
-
forwards: (pair.forwards ?? []).map(f => ({
|
|
117
|
-
name: f.name,
|
|
118
|
-
permissionIndex: f.permissionIndex ?? null,
|
|
119
|
-
namedOperator: f.namedOperator ?? null,
|
|
120
|
-
guard: f.guard?.guard ?? (typeof f.guard === "string" ? f.guard : null),
|
|
121
|
-
weight: f.weight ?? null,
|
|
122
|
-
})),
|
|
123
|
-
})),
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
export async function handleParticipationRadar(v) {
|
|
127
|
-
if (!v.radar_account) {
|
|
128
|
-
throw new Error("'radar_account' is required for participation_radar");
|
|
129
|
-
}
|
|
130
|
-
if (!v.radar_targets || v.radar_targets.length === 0) {
|
|
131
|
-
throw new Error("'radar_targets' (1-20 in-flight orders) is required for participation_radar");
|
|
132
|
-
}
|
|
133
|
-
const network = (v.network ?? "testnet");
|
|
134
|
-
const includeAlerts = v.radar_include_alerts ?? true;
|
|
135
|
-
const gaps = [];
|
|
136
|
-
const account = await resolveAddress(v.radar_account, "radar_account");
|
|
137
|
-
const targets = await Promise.all(v.radar_targets.map(async (t) => ({
|
|
138
|
-
progress: await resolveAddress(t.progress, "progress"),
|
|
139
|
-
order: t.order ? await resolveAddress(t.order, "order") : undefined,
|
|
140
|
-
})));
|
|
141
|
-
const allAddrs = targets.flatMap(t => (t.order ? [t.progress, t.order] : [t.progress]));
|
|
142
|
-
const objects = await queryObjectsBatched(allAddrs, network);
|
|
143
|
-
const byAddress = new Map();
|
|
144
|
-
for (const o of objects) {
|
|
145
|
-
const addr = fld(o, "object");
|
|
146
|
-
if (addr)
|
|
147
|
-
byAddress.set(addr, o);
|
|
148
|
-
}
|
|
149
|
-
const progressObjs = new Map();
|
|
150
|
-
const orderObjs = new Map();
|
|
151
|
-
for (const t of targets) {
|
|
152
|
-
const p = byAddress.get(t.progress);
|
|
153
|
-
if (!p) {
|
|
154
|
-
gaps.push(`Progress ${t.progress} not found on ${network} — target skipped.`);
|
|
155
|
-
continue;
|
|
156
|
-
}
|
|
157
|
-
progressObjs.set(t.progress, p);
|
|
158
|
-
if (t.order) {
|
|
159
|
-
const o = byAddress.get(t.order);
|
|
160
|
-
if (o)
|
|
161
|
-
orderObjs.set(t.order, o);
|
|
162
|
-
else
|
|
163
|
-
gaps.push(`Order ${t.order} not found on ${network} — order-holder detection disabled for ${t.progress}.`);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
if (targets.length > 0 && progressObjs.size === 0) {
|
|
167
|
-
gaps.push(`NETWORK MISMATCH SUSPECTED: 0/${targets.length} radar targets exist on network='${network}'. ` +
|
|
168
|
-
`These objects most likely live on a different network — re-run with the matching 'network' parameter.`);
|
|
169
|
-
}
|
|
170
|
-
const machineAddrs = [...new Set([...progressObjs.values()].map(p => fld(p, "machine")).filter((x) => !!x))];
|
|
171
|
-
const serviceAddrs = [...new Set([...orderObjs.values()].map(o => fld(o, "service")).filter((x) => !!x))];
|
|
172
|
-
const arbAddrs = [...new Set([...orderObjs.values()].flatMap(o => {
|
|
173
|
-
const d = fld(o, "dispute");
|
|
174
|
-
return Array.isArray(d) ? d : [];
|
|
175
|
-
}))];
|
|
176
|
-
const machineObjs = new Map();
|
|
177
|
-
const machineNodes = new Map();
|
|
178
|
-
const serviceObjs = new Map();
|
|
179
|
-
const arbObjs = new Map();
|
|
180
|
-
await Promise.all([
|
|
181
|
-
...machineAddrs.map(async (addr) => {
|
|
182
|
-
try {
|
|
183
|
-
const [objArr, nodes] = await Promise.all([
|
|
184
|
-
queryObjectsBatched([addr], network),
|
|
185
|
-
fetchMachineNodes(addr, network),
|
|
186
|
-
]);
|
|
187
|
-
if (objArr[0])
|
|
188
|
-
machineObjs.set(addr, objArr[0]);
|
|
189
|
-
machineNodes.set(addr, toRadarMachineNodes(nodes));
|
|
190
|
-
}
|
|
191
|
-
catch (e) {
|
|
192
|
-
gaps.push(`Machine ${addr} fetch failed: ${e.message} — workflow unknown for its orders.`);
|
|
193
|
-
}
|
|
194
|
-
}),
|
|
195
|
-
(async () => {
|
|
196
|
-
if (serviceAddrs.length === 0)
|
|
197
|
-
return;
|
|
198
|
-
try {
|
|
199
|
-
const arr = await queryObjectsBatched(serviceAddrs, network);
|
|
200
|
-
for (const s of arr) {
|
|
201
|
-
const addr = fld(s, "object");
|
|
202
|
-
if (addr)
|
|
203
|
-
serviceObjs.set(addr, s);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
catch (e) {
|
|
207
|
-
gaps.push(`Service query failed: ${e.message} — compensation/reward context degraded.`);
|
|
208
|
-
}
|
|
209
|
-
})(),
|
|
210
|
-
(async () => {
|
|
211
|
-
if (arbAddrs.length === 0)
|
|
212
|
-
return;
|
|
213
|
-
try {
|
|
214
|
-
const arr = await queryObjectsBatched(arbAddrs, network);
|
|
215
|
-
for (const a of arr) {
|
|
216
|
-
const addr = fld(a, "object");
|
|
217
|
-
if (addr)
|
|
218
|
-
arbObjs.set(addr, a);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
catch (e) {
|
|
222
|
-
gaps.push(`Arb query failed: ${e.message} — compensation claim detection disabled.`);
|
|
223
|
-
}
|
|
224
|
-
})(),
|
|
225
|
-
]);
|
|
226
|
-
const permissionByMachine = new Map();
|
|
227
|
-
const permAddrs = [...new Set(machineAddrs.map(a => fld(machineObjs.get(a), "permission")).filter((x) => !!x))];
|
|
228
|
-
const permData = new Map();
|
|
229
|
-
await Promise.all(permAddrs.map(async (addr) => {
|
|
230
|
-
try {
|
|
231
|
-
const [objArr, entityPermissions] = await Promise.all([
|
|
232
|
-
queryObjectsBatched([addr], network),
|
|
233
|
-
fetchEntityPermissions(addr, network),
|
|
234
|
-
]);
|
|
235
|
-
const permObj = objArr[0];
|
|
236
|
-
permData.set(addr, {
|
|
237
|
-
address: addr,
|
|
238
|
-
entity_count: fld(permObj, "entity_count"),
|
|
239
|
-
perm_remark: fld(permObj, "perm_remark"),
|
|
240
|
-
entityPermissions,
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
catch (e) {
|
|
244
|
-
gaps.push(`Permission ${addr} fetch failed: ${e.message} — operator permission matching degraded.`);
|
|
245
|
-
}
|
|
246
|
-
}));
|
|
247
|
-
for (const mAddr of machineAddrs) {
|
|
248
|
-
const pAddr = fld(machineObjs.get(mAddr), "permission");
|
|
249
|
-
if (pAddr && permData.has(pAddr))
|
|
250
|
-
permissionByMachine.set(mAddr, permData.get(pAddr));
|
|
251
|
-
}
|
|
252
|
-
let unreadTotal = 0;
|
|
253
|
-
const unreadByPeer = new Map();
|
|
254
|
-
try {
|
|
255
|
-
const convos = await watch_conversations({
|
|
256
|
-
account,
|
|
257
|
-
unreadOnly: true,
|
|
258
|
-
previewMessageCount: 0,
|
|
259
|
-
skipAutoMarkViewed: true,
|
|
260
|
-
});
|
|
261
|
-
const list = Array.isArray(convos) ? convos : convos?.conversations ?? [];
|
|
262
|
-
for (const c of list) {
|
|
263
|
-
const peer = c?.peerAddress;
|
|
264
|
-
const n = typeof c?.unreadCount === "number" ? c.unreadCount : 0;
|
|
265
|
-
if (typeof peer === "string" && n > 0) {
|
|
266
|
-
unreadByPeer.set(peer.toLowerCase(), n);
|
|
267
|
-
unreadTotal += n;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
catch {
|
|
272
|
-
gaps.push("Messenger unread unavailable (radar account is not a local messenger account, or messenger storage offline) " +
|
|
273
|
-
"— unread_messages_total reported as 0.");
|
|
274
|
-
}
|
|
275
|
-
const results = [];
|
|
276
|
-
const now = Date.now();
|
|
277
|
-
for (const t of targets) {
|
|
278
|
-
const progress = progressObjs.get(t.progress);
|
|
279
|
-
if (!progress)
|
|
280
|
-
continue;
|
|
281
|
-
const order = t.order ? orderObjs.get(t.order) : undefined;
|
|
282
|
-
const machineAddr = fld(progress, "machine");
|
|
283
|
-
const currentNode = fld(progress, "current") ?? "";
|
|
284
|
-
const namedOperators = fld(progress, "namedOperator") ?? [];
|
|
285
|
-
const namedAccounts = {};
|
|
286
|
-
for (const n of namedOperators) {
|
|
287
|
-
if (n?.name)
|
|
288
|
-
namedAccounts[n.name] = Array.isArray(n.operators) ? n.operators : [];
|
|
289
|
-
}
|
|
290
|
-
const serviceAddr = order ? fld(order, "service") : undefined;
|
|
291
|
-
const service = serviceAddr ? serviceObjs.get(serviceAddr) : undefined;
|
|
292
|
-
let pendingCompensation;
|
|
293
|
-
const builder = order ? fld(order, "builder") : undefined;
|
|
294
|
-
if (order && builder === account) {
|
|
295
|
-
const disputes = fld(order, "dispute") ?? [];
|
|
296
|
-
for (const arbAddr of disputes) {
|
|
297
|
-
const arb = arbObjs.get(arbAddr);
|
|
298
|
-
if (!arb)
|
|
299
|
-
continue;
|
|
300
|
-
const indemnity = fld(arb, "indemnity");
|
|
301
|
-
if (indemnity) {
|
|
302
|
-
pendingCompensation = {
|
|
303
|
-
arbitration: fld(arb, "arbitration") ?? arbAddr,
|
|
304
|
-
note: `Arbitration verdict recorded an indemnity (Arb ${arbAddr}). ` +
|
|
305
|
-
`Claim via service op='compensation_claim' — paid directly from the Service compensation_fund. ` +
|
|
306
|
-
`(Claimed-status is not readable from the Arb object; the contract rejects double-claims.)`,
|
|
307
|
-
};
|
|
308
|
-
break;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
const claimableRewards = [];
|
|
313
|
-
if (service && builder === account) {
|
|
314
|
-
const rewards = fld(service, "rewards") ?? [];
|
|
315
|
-
for (const r of rewards) {
|
|
316
|
-
claimableRewards.push({
|
|
317
|
-
address: r,
|
|
318
|
-
description: `Service reward ${r} (guard-gated — eligibility verified at claim time)`,
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
const completed = isConsequenceNode(currentNode, "completed");
|
|
323
|
-
const refunded = isConsequenceNode(currentNode, "refunded");
|
|
324
|
-
let orderUnread = 0;
|
|
325
|
-
if (unreadByPeer.size > 0) {
|
|
326
|
-
const counterparties = new Set();
|
|
327
|
-
if (builder)
|
|
328
|
-
counterparties.add(builder.toLowerCase());
|
|
329
|
-
for (const ops of Object.values(namedAccounts)) {
|
|
330
|
-
for (const op of ops)
|
|
331
|
-
counterparties.add(op.toLowerCase());
|
|
332
|
-
}
|
|
333
|
-
counterparties.delete(account.toLowerCase());
|
|
334
|
-
for (const peer of counterparties) {
|
|
335
|
-
orderUnread += unreadByPeer.get(peer) ?? 0;
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
const radarInput = {
|
|
339
|
-
account,
|
|
340
|
-
progress_address: t.progress,
|
|
341
|
-
order_address: t.order,
|
|
342
|
-
current_node: currentNode,
|
|
343
|
-
order_holder: builder,
|
|
344
|
-
machine_nodes: machineAddr ? machineNodes.get(machineAddr) : undefined,
|
|
345
|
-
permission: machineAddr ? permissionByMachine.get(machineAddr) ?? null : null,
|
|
346
|
-
named_accounts: namedAccounts,
|
|
347
|
-
claimable_rewards: claimableRewards.length > 0 ? claimableRewards : undefined,
|
|
348
|
-
pending_compensation: pendingCompensation,
|
|
349
|
-
rating_pending: completed && builder === account,
|
|
350
|
-
unread_messages: orderUnread > 0 ? orderUnread : undefined,
|
|
351
|
-
last_progress_at: fld(progress, "current_time") ?? undefined,
|
|
352
|
-
now,
|
|
353
|
-
};
|
|
354
|
-
const result = analyzeOrderParticipation(radarInput);
|
|
355
|
-
if (result.perspective === "operator") {
|
|
356
|
-
result.interest_analysis = analyzeMerchantInterest({
|
|
357
|
-
account,
|
|
358
|
-
current_node: currentNode,
|
|
359
|
-
operable: result.operable,
|
|
360
|
-
waiting_on: result.waiting_on,
|
|
361
|
-
order_amount: balanceStr(fld(order, "amount")),
|
|
362
|
-
token_type: balanceToken(fld(order, "amount")),
|
|
363
|
-
allocation: summarizeAllocation(fld(service, "order_allocators"), account),
|
|
364
|
-
compensation_fund: balanceStr(fld(service, "compensation_fund")),
|
|
365
|
-
arbitration_bound: (fld(service, "arbitrations") ?? []).length > 0,
|
|
366
|
-
rewards_count: (fld(service, "rewards") ?? []).length,
|
|
367
|
-
stalled_hours: radarInput.last_progress_at != null
|
|
368
|
-
? (now - radarInput.last_progress_at) / 3_600_000
|
|
369
|
-
: undefined,
|
|
370
|
-
terminal: completed ? "completed" : refunded ? "refunded" : null,
|
|
371
|
-
unread_messages: orderUnread > 0 ? orderUnread : undefined,
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
if (includeAlerts && order) {
|
|
375
|
-
const snapshot = {
|
|
376
|
-
order_id: t.order,
|
|
377
|
-
service_id: serviceAddr ?? "",
|
|
378
|
-
current_node: currentNode || undefined,
|
|
379
|
-
created_at: Number(fld(order, "time") ?? now) || now,
|
|
380
|
-
last_progress_at: fld(progress, "current_time") ?? undefined,
|
|
381
|
-
now,
|
|
382
|
-
order_amount: (() => { try {
|
|
383
|
-
return BigInt(fld(order, "amount") ?? 0);
|
|
384
|
-
}
|
|
385
|
-
catch {
|
|
386
|
-
return undefined;
|
|
387
|
-
} })(),
|
|
388
|
-
compensation_balance: (() => { try {
|
|
389
|
-
const c = fld(service, "compensation_fund");
|
|
390
|
-
return c != null ? BigInt(c) : undefined;
|
|
391
|
-
}
|
|
392
|
-
catch {
|
|
393
|
-
return undefined;
|
|
394
|
-
} })(),
|
|
395
|
-
token: registryDisplayHint(extractGenericTokenType(fld(service, "type_raw"))),
|
|
396
|
-
has_arbitration: (fld(service, "arbitrations") ?? []).length > 0,
|
|
397
|
-
pending_user_action: result.operable.some(f => f.execution_path === "order_holder"),
|
|
398
|
-
completed,
|
|
399
|
-
refunded,
|
|
400
|
-
};
|
|
401
|
-
try {
|
|
402
|
-
const alerts = monitorOrder({
|
|
403
|
-
current: snapshot,
|
|
404
|
-
thresholds: v.radar_monitor_thresholds,
|
|
405
|
-
});
|
|
406
|
-
if (alerts.length > 0) {
|
|
407
|
-
result.attached_alerts = alerts;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
catch (e) {
|
|
411
|
-
gaps.push(`Order monitor failed for ${t.order}: ${e.message}.`);
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
results.push(result);
|
|
415
|
-
}
|
|
416
|
-
const dashboard = aggregateRadar(results, unreadTotal);
|
|
417
|
-
return {
|
|
418
|
-
action: "participation_radar",
|
|
419
|
-
account,
|
|
420
|
-
orders_analyzed: dashboard.orders_analyzed,
|
|
421
|
-
actionable: dashboard.actionable,
|
|
422
|
-
waiting: dashboard.waiting,
|
|
423
|
-
all_pending_claims: dashboard.all_pending_claims,
|
|
424
|
-
unread_messages_total: dashboard.unread_messages_total,
|
|
425
|
-
data_gaps: gaps,
|
|
426
|
-
summary: dashboard.summary,
|
|
427
|
-
};
|
|
428
|
-
}
|
|
1
|
+
import{LocalMark,query_objects,query_table,watch_conversations}from'@wowok/wowok';import{analyzeOrderParticipation,aggregateRadar,isConsequenceNode}from'../participation/radar-core.js';import{monitorOrder}from'../customer/order-monitor.js';import{analyzeMerchantInterest}from'../participation/merchant-interest.js';import{analyzeCustomerInterest}from'../participation/customer-interest.js';import{analyzeSupplierInterest}from'../participation/supplier-interest.js';import{analyzeCollaboratorInterest}from'../participation/collaborator-interest.js';import{fetchMachineNodes}from'./machine-nodes.js';import{extractGenericTokenType,registryDisplayHint}from'../knowledge/fund-layer.js';const QUERY_BATCH=0x32;function fld(a,b){return a?.[b]??a?.['data']?.[b];}async function resolveAddress(a,b){const c=await LocalMark['Instance']()['get_address'](a);if(!c)throw new Error('Cannot\x20resolve\x20'+b+'\x20\x27'+a+'\x27\x20—\x20not\x20a\x20valid\x20address\x20and\x20no\x20LocalMark\x20entry\x20found.\x20'+'Register\x20it\x20via\x20local_mark_operation\x20or\x20pass\x20the\x200x\x20address\x20directly.');return c;}function balanceStr(a){if(a==null)return undefined;if(typeof a==='object'&&'balance'in a)return String(a['balance']);return String(a);}function balanceToken(a){if(a!=null&&typeof a==='object'&&typeof a['token_type']==='string')return a['token_type'];return undefined;}function summarizeAllocation(a,b){const c=Array['isArray'](a)?a:Array['isArray'](a?.['allocators'])?a['allocators']:[];if(c['length']===0x0)return undefined;let d=0x0,e=0x0,f=0x0,g=0x0;const h=b['toLowerCase']();for(const i of c){for(const j of i?.['sharing']??[]){d++;const k=j?.['who'];if(k==null)continue;if(typeof k==='object'&&'GuardIdentifier'in k)e++;else{if(typeof k==='object'&&'Signer'in k)g++;else{if(typeof k==='object'&&'Entity'in k){const l=k['Entity'],m=typeof l==='string'?l:l?.['name_or_address'];if(typeof m==='string'&&m['toLowerCase']()===h)f++;}else typeof k==='string'&&k['toLowerCase']()===h&&f++;}}}}return{'recipient_slots':d,'guard_gated_slots':e,'direct_to_me_slots':f,'to_payer_slots':g};}async function queryObjectsBatched(a,b){const c=[];for(let d=0x0;d<a['length'];d+=QUERY_BATCH){const e=a['slice'](d,d+QUERY_BATCH),f=await query_objects({'objects':e,'network':b});c['push'](...f?.['objects']??[]);}return c;}async function fetchEntityPermissions(a,b){const c=new Map(),d=[];let e=undefined;for(;;){const g=await query_table({'parent':a,'cursor':e??undefined,'network':b});if(!g?.['items']||g['items']['length']===0x0)break;for(const h of g['items']){if(h['object'])d['push'](h['object']);}if(!g['hasNextPage']||!g['nextCursor'])break;e=g['nextCursor'];}const f=await queryObjectsBatched(d,b);for(const i of f){if(i?.['type']!=='TableItem_PermissionPerm')continue;const j=fld(i,'address'),k=fld(i,'perm')??[],l=k['map'](m=>typeof m==='number'?m:typeof m?.['index']==='number'?m['index']:null)['filter'](m=>m!==null);if(j)c['set'](j,l);}return c;}function toRadarMachineNodes(a){return a['map'](b=>({'name':b['name'],'pairs':(Array['isArray'](b['value'])?b['value']:[])['map'](c=>({'prev_node':c['prev_node'],'threshold':c['threshold']??undefined,'forwards':(c['forwards']??[])['map'](d=>({'name':d['name'],'permissionIndex':d['permissionIndex']??null,'namedOperator':d['namedOperator']??null,'guard':d['guard']?.['guard']??(typeof d['guard']==='string'?d['guard']:null),'weight':d['weight']??null}))}))}));}export async function handleParticipationRadar(a){if(!a['radar_account'])throw new Error('\x27radar_account\x27\x20is\x20required\x20for\x20participation_radar');if(!a['radar_targets']||a['radar_targets']['length']===0x0)throw new Error('\x27radar_targets\x27\x20(1-20\x20in-flight\x20orders)\x20is\x20required\x20for\x20participation_radar');const b=a['network']??'testnet',d=a['radar_include_alerts']??!![],f=[],g=await resolveAddress(a['radar_account'],'radar_account'),h=await Promise['all'](a['radar_targets']['map'](async I=>({'progress':await resolveAddress(I['progress'],'progress'),'order':I['order']?await resolveAddress(I['order'],'order'):undefined}))),i=h['flatMap'](I=>I['order']?[I['progress'],I['order']]:[I['progress']]),j=await queryObjectsBatched(i,b),k=new Map();for(const I of j){const J=fld(I,'object');if(J)k['set'](J,I);}const l=new Map(),m=new Map();for(const K of h){const L=k['get'](K['progress']);if(!L){f['push']('Progress\x20'+K['progress']+'\x20not\x20found\x20on\x20'+b+'\x20—\x20target\x20skipped.');continue;}l['set'](K['progress'],L);if(K['order']){const M=k['get'](K['order']);if(M)m['set'](K['order'],M);else f['push']('Order\x20'+K['order']+'\x20not\x20found\x20on\x20'+b+'\x20—\x20order-holder\x20detection\x20disabled\x20for\x20'+K['progress']+'.');}}h['length']>0x0&&l['size']===0x0&&f['push']('NETWORK\x20MISMATCH\x20SUSPECTED:\x200/'+h['length']+'\x20radar\x20targets\x20exist\x20on\x20network=\x27'+b+'\x27.\x20'+'These\x20objects\x20most\x20likely\x20live\x20on\x20a\x20different\x20network\x20—\x20re-run\x20with\x20the\x20matching\x20\x27network\x27\x20parameter.');const q=[...new Set([...l['values']()]['map'](N=>fld(N,'machine'))['filter'](N=>!!N))],s=[...new Set([...m['values']()]['map'](N=>fld(N,'service'))['filter'](N=>!!N))],u=[...new Set([...m['values']()]['flatMap'](N=>{const O=fld(N,'dispute');return Array['isArray'](O)?O:[];}))],w=new Map(),x=new Map(),y=new Map(),z=new Map();await Promise['all']([...q['map'](async N=>{try{const [O,P]=await Promise['all']([queryObjectsBatched([N],b),fetchMachineNodes(N,b)]);if(O[0x0])w['set'](N,O[0x0]);x['set'](N,toRadarMachineNodes(P));}catch(Q){f['push']('Machine\x20'+N+'\x20fetch\x20failed:\x20'+Q['message']+'\x20—\x20workflow\x20unknown\x20for\x20its\x20orders.');}}),((async()=>{if(s['length']===0x0)return;try{const N=await queryObjectsBatched(s,b);for(const O of N){const P=fld(O,'object');if(P)y['set'](P,O);}}catch(Q){f['push']('Service\x20query\x20failed:\x20'+Q['message']+'\x20—\x20compensation/reward\x20context\x20degraded.');}})()),((async()=>{if(u['length']===0x0)return;try{const N=await queryObjectsBatched(u,b);for(const O of N){const P=fld(O,'object');if(P)z['set'](P,O);}}catch(Q){f['push']('Arb\x20query\x20failed:\x20'+Q['message']+'\x20—\x20compensation\x20claim\x20detection\x20disabled.');}})())]);const A=new Map(),B=[...new Set(q['map'](N=>fld(w['get'](N),'permission'))['filter'](N=>!!N))],C=new Map();await Promise['all'](B['map'](async N=>{try{const [O,P]=await Promise['all']([queryObjectsBatched([N],b),fetchEntityPermissions(N,b)]),Q=O[0x0];C['set'](N,{'address':N,'entity_count':fld(Q,'entity_count'),'perm_remark':fld(Q,'perm_remark'),'entityPermissions':P,'owner':fld(Q,'builder')});}catch(R){f['push']('Permission\x20'+N+'\x20fetch\x20failed:\x20'+R['message']+'\x20—\x20operator\x20permission\x20matching\x20degraded.');}}));for(const N of q){const O=fld(w['get'](N),'permission');if(O&&C['has'](O))A['set'](N,C['get'](O));}let D=0x0;const E=new Map();try{const P=await watch_conversations({'account':g,'unreadOnly':!![],'previewMessageCount':0x0,'skipAutoMarkViewed':!![]}),Q=Array['isArray'](P)?P:P?.['conversations']??[];for(const R of Q){const S=R?.['peerAddress'],T=typeof R?.['unreadCount']==='number'?R['unreadCount']:0x0;typeof S==='string'&&T>0x0&&(E['set'](S['toLowerCase'](),T),D+=T);}}catch{f['push']('Messenger\x20unread\x20unavailable\x20(radar\x20account\x20is\x20not\x20a\x20local\x20messenger\x20account,\x20or\x20messenger\x20storage\x20offline)\x20'+'—\x20unread_messages_total\x20reported\x20as\x200.');}const F=[],G=Date['now']();for(const U of h){const V=l['get'](U['progress']);if(!V)continue;const W=U['order']?m['get'](U['order']):undefined,X=fld(V,'machine'),Y=fld(V,'current')??'',Z=fld(V,'namedOperator')??[],a0={};for(const ae of Z){if(ae?.['name'])a0[ae['name']]=Array['isArray'](ae['operators'])?ae['operators']:[];}const a1=W?fld(W,'service'):undefined,a2=a1?y['get'](a1):undefined;let a3;const a4=W?fld(W,'builder'):undefined;if(W&&a4===g){const af=fld(W,'dispute')??[];for(const ag of af){const ah=z['get'](ag);if(!ah)continue;const ai=fld(ah,'indemnity');if(ai){a3={'arbitration':fld(ah,'arbitration')??ag,'note':'Arbitration\x20verdict\x20recorded\x20an\x20indemnity\x20(Arb\x20'+ag+').\x20'+'Claim\x20via\x20service\x20op=\x27compensation_claim\x27\x20—\x20paid\x20directly\x20from\x20the\x20Service\x20compensation_fund.\x20'+'(Claimed-status\x20is\x20not\x20readable\x20from\x20the\x20Arb\x20object;\x20the\x20contract\x20rejects\x20double-claims.)'};break;}}}const a5=[];if(a2&&a4===g){const aj=fld(a2,'rewards')??[];for(const ak of aj){a5['push']({'address':ak,'description':'Service\x20reward\x20'+ak+'\x20(guard-gated\x20—\x20eligibility\x20verified\x20at\x20claim\x20time)'});}}const a6=isConsequenceNode(Y,'completed'),a7=isConsequenceNode(Y,'refunded');let a8=0x0;if(E['size']>0x0){const al=new Set();if(a4)al['add'](a4['toLowerCase']());for(const am of Object['values'](a0)){for(const an of am)al['add'](an['toLowerCase']());}al['delete'](g['toLowerCase']());for(const ao of al){a8+=E['get'](ao)??0x0;}}const a9={'account':g,'progress_address':U['progress'],'order_address':U['order'],'current_node':Y,'order_holder':a4,'machine_nodes':X?x['get'](X):undefined,'permission':X?A['get'](X)??null:null,'named_accounts':a0,'service_builder':X?A['get'](X)?.['owner']:undefined,'claimable_rewards':a5['length']>0x0?a5:undefined,'pending_compensation':a3,'rating_pending':a6&&a4===g,'unread_messages':a8>0x0?a8:undefined,'last_progress_at':fld(V,'current_time')??undefined,'now':G},aa=analyzeOrderParticipation(a9),ab=(fld(a2,'arbitrations')??[])['length']>0x0,ac=a6?'completed':a7?'refunded':null,ad=a9['last_progress_at']!=null?(G-a9['last_progress_at'])/0x36ee80:undefined;if(aa['perspective']==='merchant')aa['interest_analysis']=analyzeMerchantInterest({'account':g,'current_node':Y,'operable':aa['operable'],'waiting_on':aa['waiting_on'],'order_amount':balanceStr(fld(W,'amount')),'token_type':balanceToken(fld(W,'amount')),'allocation':summarizeAllocation(fld(a2,'order_allocators'),g),'compensation_fund':balanceStr(fld(a2,'compensation_fund')),'arbitration_bound':ab,'rewards_count':(fld(a2,'rewards')??[])['length'],'stalled_hours':ad,'terminal':ac,'unread_messages':a8>0x0?a8:undefined});else{if(aa['perspective']==='supplier')aa['interest_analysis']=analyzeSupplierInterest({'account':g,'current_node':Y,'operable':aa['operable'],'waiting_on':aa['waiting_on'],'order_amount':balanceStr(fld(W,'amount')),'token_type':balanceToken(fld(W,'amount')),'arbitration_bound':ab,'compensation_fund':balanceStr(fld(a2,'compensation_fund')),'terminal':ac,'stalled_hours':ad,'unread_messages':a8>0x0?a8:undefined});else{if(aa['perspective']==='collaborator')aa['interest_analysis']=analyzeCollaboratorInterest({'account':g,'current_node':Y,'operable':aa['operable'],'waiting_on':aa['waiting_on'],'collaborator_kind':aa['collaborator_kind'],'arbitration_bound':ab,'terminal':ac,'stalled_hours':ad,'unread_messages':a8>0x0?a8:undefined});else aa['perspective']==='customer'&&(aa['interest_analysis']=analyzeCustomerInterest({'account':g,'current_node':Y,'operable':aa['operable'],'waiting_on':aa['waiting_on'],'order_amount':balanceStr(fld(W,'amount')),'token_type':balanceToken(fld(W,'amount')),'compensation_fund':balanceStr(fld(a2,'compensation_fund')),'arbitration_bound':ab,'terminal':ac,'stalled_hours':ad,'unread_messages':a8>0x0?a8:undefined}));}}if(d&&W){const ap={'order_id':U['order'],'service_id':a1??'','current_node':Y||undefined,'created_at':Number(fld(W,'time')??G)||G,'last_progress_at':fld(V,'current_time')??undefined,'now':G,'order_amount':((()=>{try{return BigInt(fld(W,'amount')??0x0);}catch{return undefined;}})()),'compensation_balance':((()=>{try{const aq=fld(a2,'compensation_fund');return aq!=null?BigInt(aq):undefined;}catch{return undefined;}})()),'token':registryDisplayHint(extractGenericTokenType(fld(a2,'type_raw'))),'has_arbitration':(fld(a2,'arbitrations')??[])['length']>0x0,'pending_user_action':aa['operable']['some'](aq=>aq['execution_path']==='order_holder'),'completed':a6,'refunded':a7};try{const aq=monitorOrder({'current':ap,'thresholds':a['radar_monitor_thresholds']});aq['length']>0x0&&(aa['attached_alerts']=aq);}catch(ar){f['push']('Order\x20monitor\x20failed\x20for\x20'+U['order']+':\x20'+ar['message']+'.');}}F['push'](aa);}const H=aggregateRadar(F,D);return{'action':'participation_radar','account':g,'orders_analyzed':H['orders_analyzed'],'actionable':H['actionable'],'waiting':H['waiting'],'all_pending_claims':H['all_pending_claims'],'unread_messages_total':H['unread_messages_total'],'data_gaps':f,'summary':H['summary']};}
|
|
@@ -1,109 +1 @@
|
|
|
1
|
-
import { analyzeBusinessIntent } from
|
|
2
|
-
import { aggregateProjectRisks } from "./risk-aggregator.js";
|
|
3
|
-
import { traceSubsteps } from "./substep-trace.js";
|
|
4
|
-
import { updateStageCache } from "./index.js";
|
|
5
|
-
import { checkObjectReuseRules, checkImmutabilityRules, } from "../knowledge/safety-rules.js";
|
|
6
|
-
export function handleAnalyzeIntent(v) {
|
|
7
|
-
const user_intent = (v.intent ?? v.project_description ?? v.project_name ?? "").trim();
|
|
8
|
-
if (!user_intent) {
|
|
9
|
-
throw new Error("analyze_intent requires 'intent' (business description text). " +
|
|
10
|
-
"Example: intent='I want to open an online toy store with escrow and dispute resolution'.");
|
|
11
|
-
}
|
|
12
|
-
const result = analyzeBusinessIntent({
|
|
13
|
-
user_intent,
|
|
14
|
-
project_name: v.project_name,
|
|
15
|
-
target_objects: v.target_objects,
|
|
16
|
-
industry: v.project_industry,
|
|
17
|
-
});
|
|
18
|
-
const project_prefix = (v.project ?? "").trim();
|
|
19
|
-
if (project_prefix) {
|
|
20
|
-
updateStageCache(project_prefix, (v.version ?? "v1").trim(), {
|
|
21
|
-
stage: 2,
|
|
22
|
-
puzzles: result.puzzles,
|
|
23
|
-
business_intent: user_intent,
|
|
24
|
-
industry: result.intent_parsed.industry,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return { action: "analyze_intent", ...result };
|
|
28
|
-
}
|
|
29
|
-
export function handleAggregateRisks(v) {
|
|
30
|
-
const project_prefix = (v.project ?? "").trim();
|
|
31
|
-
if (!project_prefix) {
|
|
32
|
-
throw new Error("aggregate_risks requires 'project' (project prefix, e.g. 'myshop'). " +
|
|
33
|
-
"Use the same prefix as create_project so findings map to the project namespace.");
|
|
34
|
-
}
|
|
35
|
-
const version = (v.version ?? "v1").trim();
|
|
36
|
-
let puzzles;
|
|
37
|
-
let intent_echo;
|
|
38
|
-
if (v.puzzles) {
|
|
39
|
-
puzzles = Object.fromEntries(Object.entries(v.puzzles).map(([k, e]) => [
|
|
40
|
-
k,
|
|
41
|
-
{ puzzle: e.puzzle, completeness: e.completeness, missing_dimensions: e.missing_dimensions },
|
|
42
|
-
]));
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
const user_intent = (v.intent ?? v.project_description ?? v.project_name ?? "").trim();
|
|
46
|
-
if (!user_intent) {
|
|
47
|
-
throw new Error("aggregate_risks requires 'puzzles' (from a prior analyze_intent result) " +
|
|
48
|
-
"OR 'intent' (business description — analyze_intent runs automatically first).");
|
|
49
|
-
}
|
|
50
|
-
const analyzed = analyzeBusinessIntent({
|
|
51
|
-
user_intent,
|
|
52
|
-
project_name: v.project_name,
|
|
53
|
-
industry: v.project_industry,
|
|
54
|
-
});
|
|
55
|
-
puzzles = analyzed.puzzles;
|
|
56
|
-
intent_echo = {
|
|
57
|
-
primary_object: analyzed.intent_parsed.primary_object,
|
|
58
|
-
industry: analyzed.intent_parsed.industry,
|
|
59
|
-
overall_completeness: analyzed.overall_completeness,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
const result = aggregateProjectRisks({
|
|
63
|
-
project_prefix,
|
|
64
|
-
version,
|
|
65
|
-
industry: v.project_industry,
|
|
66
|
-
puzzles,
|
|
67
|
-
severity_threshold: v.severity_threshold,
|
|
68
|
-
user_confirmed_high_risks: v.user_confirmed_high_risks,
|
|
69
|
-
});
|
|
70
|
-
const safety_findings = [
|
|
71
|
-
...(v.planned_objects ? checkObjectReuseRules(v.planned_objects) : []),
|
|
72
|
-
...(v.planned_operations ? checkImmutabilityRules(v.planned_operations) : []),
|
|
73
|
-
];
|
|
74
|
-
updateStageCache(project_prefix, version, {
|
|
75
|
-
stage: 3,
|
|
76
|
-
risk_status: result.status,
|
|
77
|
-
risk_can_proceed: result.status === "RISK_PASSED",
|
|
78
|
-
});
|
|
79
|
-
return {
|
|
80
|
-
action: "aggregate_risks",
|
|
81
|
-
...result,
|
|
82
|
-
...(safety_findings.length > 0 ? { safety_findings } : {}),
|
|
83
|
-
...(intent_echo ? { intent_echo } : {}),
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
export function handleTraceSubsteps(v) {
|
|
87
|
-
const project_prefix = (v.project ?? "").trim();
|
|
88
|
-
if (!project_prefix) {
|
|
89
|
-
throw new Error("trace_substeps requires 'project' (project prefix, e.g. 'myshop').");
|
|
90
|
-
}
|
|
91
|
-
if (!v.substeps || v.substeps.length === 0) {
|
|
92
|
-
throw new Error("trace_substeps requires 'substeps' (non-empty array of substep execution records, " +
|
|
93
|
-
"63-spec §2.1). Construct them from your deployment execution trace: each onchain_operations " +
|
|
94
|
-
"call = one substep with step_id 'T<step>.<substep>', input_refs pointing at upstream substeps.");
|
|
95
|
-
}
|
|
96
|
-
const result = traceSubsteps({
|
|
97
|
-
project_prefix,
|
|
98
|
-
version: (v.version ?? "v1").trim(),
|
|
99
|
-
network: v.network ?? "testnet",
|
|
100
|
-
substeps: v.substeps,
|
|
101
|
-
edges: v.substep_edges,
|
|
102
|
-
});
|
|
103
|
-
updateStageCache(project_prefix, (v.version ?? "v1").trim(), {
|
|
104
|
-
stage: 5,
|
|
105
|
-
trace_coherent: result.coherent,
|
|
106
|
-
trace_can_proceed: result.coherent,
|
|
107
|
-
});
|
|
108
|
-
return { action: "trace_substeps", ...result };
|
|
109
|
-
}
|
|
1
|
+
import{analyzeBusinessIntent}from'./business-puzzle.js';import{aggregateProjectRisks}from'./risk-aggregator.js';import{traceSubsteps}from'./substep-trace.js';import{updateStageCache}from'./index.js';import{checkObjectReuseRules,checkImmutabilityRules}from'../knowledge/safety-rules.js';export function handleAnalyzeIntent(a){const b=(a['intent']??a['project_description']??a['project_name']??'')['trim']();if(!b)throw new Error('analyze_intent\x20requires\x20\x27intent\x27\x20(business\x20description\x20text).\x20'+'Example:\x20intent=\x27I\x20want\x20to\x20open\x20an\x20online\x20toy\x20store\x20with\x20escrow\x20and\x20dispute\x20resolution\x27.');const c=analyzeBusinessIntent({'user_intent':b,'project_name':a['project_name'],'target_objects':a['target_objects'],'industry':a['project_industry']}),d=(a['project']??'')['trim']();return d&&updateStageCache(d,(a['version']??'v1')['trim'](),{'stage':0x2,'puzzles':c['puzzles'],'business_intent':b,'industry':c['intent_parsed']['industry']}),{'action':'analyze_intent',...c};}export function handleAggregateRisks(a){const b=(a['project']??'')['trim']();if(!b)throw new Error('aggregate_risks\x20requires\x20\x27project\x27\x20(project\x20prefix,\x20e.g.\x20\x27myshop\x27).\x20'+'Use\x20the\x20same\x20prefix\x20as\x20create_project\x20so\x20findings\x20map\x20to\x20the\x20project\x20namespace.');const c=(a['version']??'v1')['trim']();let d,e;if(a['puzzles'])d=Object['fromEntries'](Object['entries'](a['puzzles'])['map'](([h,i])=>[h,{'puzzle':i['puzzle'],'completeness':i['completeness'],'missing_dimensions':i['missing_dimensions']}]));else{const h=(a['intent']??a['project_description']??a['project_name']??'')['trim']();if(!h)throw new Error('aggregate_risks\x20requires\x20\x27puzzles\x27\x20(from\x20a\x20prior\x20analyze_intent\x20result)\x20'+'OR\x20\x27intent\x27\x20(business\x20description\x20—\x20analyze_intent\x20runs\x20automatically\x20first).');const i=analyzeBusinessIntent({'user_intent':h,'project_name':a['project_name'],'industry':a['project_industry']});d=i['puzzles'],e={'primary_object':i['intent_parsed']['primary_object'],'industry':i['intent_parsed']['industry'],'overall_completeness':i['overall_completeness']};}const f=aggregateProjectRisks({'project_prefix':b,'version':c,'industry':a['project_industry'],'puzzles':d,'severity_threshold':a['severity_threshold'],'user_confirmed_high_risks':a['user_confirmed_high_risks']}),g=[...a['planned_objects']?checkObjectReuseRules(a['planned_objects']):[],...a['planned_operations']?checkImmutabilityRules(a['planned_operations']):[]];return updateStageCache(b,c,{'stage':0x3,'risk_status':f['status'],'risk_can_proceed':f['status']==='RISK_PASSED'}),{'action':'aggregate_risks',...f,...g['length']>0x0?{'safety_findings':g}:{},...e?{'intent_echo':e}:{}};}export function handleTraceSubsteps(a){const b=(a['project']??'')['trim']();if(!b)throw new Error('trace_substeps\x20requires\x20\x27project\x27\x20(project\x20prefix,\x20e.g.\x20\x27myshop\x27).');if(!a['substeps']||a['substeps']['length']===0x0)throw new Error('trace_substeps\x20requires\x20\x27substeps\x27\x20(non-empty\x20array\x20of\x20substep\x20execution\x20records,\x20'+'63-spec\x20§2.1).\x20Construct\x20them\x20from\x20your\x20deployment\x20execution\x20trace:\x20each\x20onchain_operations\x20'+'call\x20=\x20one\x20substep\x20with\x20step_id\x20\x27T<step>.<substep>\x27,\x20input_refs\x20pointing\x20at\x20upstream\x20substeps.');const c=traceSubsteps({'project_prefix':b,'version':(a['version']??'v1')['trim'](),'network':a['network']??'testnet','substeps':a['substeps'],'edges':a['substep_edges']});return updateStageCache(b,(a['version']??'v1')['trim'](),{'stage':0x5,'trace_coherent':c['coherent'],'trace_can_proceed':c['coherent']}),{'action':'trace_substeps',...c};}
|