@wowok/agent-mcp 2.7.1 → 2.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.js +1 -1
- package/dist/config/runtime.js +1 -238
- package/dist/customer/account-events.d.ts +32 -0
- package/dist/customer/account-events.js +1 -0
- package/dist/customer/customer-advice.d.ts +1 -0
- package/dist/customer/customer-advice.js +1 -130
- package/dist/customer/index.js +1 -11
- package/dist/customer/industry-risks.js +1 -438
- package/dist/customer/info-puzzle.js +1 -681
- package/dist/customer/order-monitor.js +1 -328
- package/dist/customer/order-strategy.d.ts +1 -1
- package/dist/customer/order-strategy.js +1 -373
- package/dist/customer/post-purchase.js +1 -351
- package/dist/customer/preorder-compare.js +1 -34
- package/dist/customer/reminder-system.d.ts +2 -0
- package/dist/customer/reminder-system.js +1 -316
- package/dist/customer/risk-assessment.d.ts +1 -0
- package/dist/customer/risk-assessment.js +1 -397
- package/dist/customer/types.d.ts +2 -0
- package/dist/customer/types.js +1 -13
- package/dist/customer/user-preferences.js +1 -460
- package/dist/evaluation/arbitration-game.d.ts +9 -2
- package/dist/evaluation/arbitration-game.js +1 -48
- package/dist/evaluation/builtins/arbitration-score.d.ts +41 -0
- package/dist/evaluation/builtins/arbitration-score.js +1 -0
- package/dist/evaluation/builtins/demand-match.js +1 -153
- package/dist/evaluation/builtins/index.d.ts +1 -0
- package/dist/evaluation/builtins/index.js +1 -10
- package/dist/evaluation/builtins/service-risk.js +1 -55
- package/dist/evaluation/capability.js +1 -13
- package/dist/evaluation/category-match-rules.d.ts +30 -0
- package/dist/evaluation/category-match-rules.js +1 -0
- package/dist/evaluation/composer.js +1 -40
- package/dist/evaluation/engine.js +1 -175
- package/dist/evaluation/extract.js +1 -115
- package/dist/evaluation/game-strategy.d.ts +27 -0
- package/dist/evaluation/game-strategy.js +1 -0
- package/dist/evaluation/gap.js +1 -100
- package/dist/evaluation/index.d.ts +2 -0
- package/dist/evaluation/index.js +1 -11
- package/dist/evaluation/location-match.d.ts +42 -0
- package/dist/evaluation/location-match.js +1 -0
- package/dist/evaluation/node-game.d.ts +31 -3
- package/dist/evaluation/node-game.js +1 -57
- package/dist/evaluation/path-reasoning.d.ts +35 -0
- package/dist/evaluation/path-reasoning.js +1 -0
- package/dist/evaluation/region.d.ts +6 -0
- package/dist/evaluation/region.js +1 -36
- package/dist/evaluation/types.d.ts +18 -0
- package/dist/evaluation/types.js +1 -1
- package/dist/evaluation/user-injection.js +1 -27
- package/dist/experience/experience-reuse.js +1 -103
- package/dist/experience/index.js +1 -5
- package/dist/experience/intent-distill.js +1 -83
- package/dist/experience/realtime-feedback.js +1 -94
- package/dist/experience/types.js +1 -1
- package/dist/experience/user-profile.d.ts +1 -1
- package/dist/experience/user-profile.js +1 -171
- package/dist/extensions/business-modules.js +1 -287
- package/dist/extensions/capability-manifest.js +1 -781
- package/dist/extensions/constraint-registry.js +1 -198
- package/dist/extensions/index.d.ts +6 -0
- package/dist/extensions/index.js +1 -6
- package/dist/extensions/industry-layers.d.ts +75 -0
- package/dist/extensions/industry-layers.js +1 -0
- package/dist/extensions/industry-pack.d.ts +105 -0
- package/dist/extensions/industry-pack.js +1 -0
- package/dist/extensions/metric-registry.js +1 -257
- package/dist/extensions/mode-evaluator.d.ts +1 -1
- package/dist/extensions/mode-evaluator.js +1 -170
- package/dist/extensions/modes.js +1 -499
- package/dist/extensions/registry.d.ts +1 -0
- package/dist/extensions/registry.js +1 -717
- package/dist/extensions/types.js +1 -1
- package/dist/graph/base.d.ts +8 -0
- package/dist/graph/base.js +1 -0
- package/dist/harness/auto-escalation.js +1 -68
- package/dist/harness/checkpoint.js +1 -129
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/index.js +1 -78
- package/dist/harness/plan.d.ts +2 -0
- package/dist/harness/plan.js +1 -315
- package/dist/harness/recover.d.ts +1 -1
- package/dist/harness/recover.js +1 -139
- package/dist/harness/types.d.ts +2 -3
- package/dist/harness/types.js +1 -1
- package/dist/harness/verify.js +1 -237
- package/dist/index.js +1 -273
- package/dist/intent/enrich.js +1 -67
- package/dist/intent/index.js +1 -60
- package/dist/intent/matcher.js +1 -81
- package/dist/intent/store.js +1 -55
- package/dist/intent/types.js +1 -10
- package/dist/knowledge/acquisition-flywheel.js +1 -192
- package/dist/knowledge/allocation-confirm.js +1 -534
- package/dist/knowledge/allocation-context.js +1 -249
- package/dist/knowledge/allocation-ledger.js +1 -463
- package/dist/knowledge/allocation-puzzle.js +1 -298
- package/dist/knowledge/allocation-risk.js +1 -568
- package/dist/knowledge/allocation-templates.js +1 -970
- package/dist/knowledge/allocation-translation.js +1 -585
- package/dist/knowledge/anti-cheat.d.ts +37 -0
- package/dist/knowledge/anti-cheat.js +1 -0
- package/dist/knowledge/arb-confirm.d.ts +28 -0
- package/dist/knowledge/arb-confirm.js +1 -0
- package/dist/knowledge/arb-risk.js +1 -210
- package/dist/knowledge/arb-translation.d.ts +48 -0
- package/dist/knowledge/arb-translation.js +1 -0
- package/dist/knowledge/arbitration-confirm.js +1 -559
- package/dist/knowledge/arbitration-context.js +1 -505
- package/dist/knowledge/arbitration-ledger.js +1 -521
- package/dist/knowledge/arbitration-puzzle.js +1 -304
- package/dist/knowledge/arbitration-risk.js +1 -423
- package/dist/knowledge/arbitration-templates.js +1 -276
- package/dist/knowledge/arbitration-translation.js +1 -487
- package/dist/knowledge/audit-rules.js +1 -141
- package/dist/knowledge/bridge-confirm.d.ts +26 -0
- package/dist/knowledge/bridge-confirm.js +1 -0
- package/dist/knowledge/bridge-risk.js +1 -263
- package/dist/knowledge/bridge-translation.d.ts +37 -0
- package/dist/knowledge/bridge-translation.js +1 -0
- package/dist/knowledge/contact-confirm.d.ts +27 -0
- package/dist/knowledge/contact-confirm.js +1 -0
- package/dist/knowledge/contact-risk.js +1 -200
- package/dist/knowledge/contact-templates.js +1 -60
- package/dist/knowledge/contact-translation.d.ts +39 -0
- package/dist/knowledge/contact-translation.js +1 -0
- package/dist/knowledge/demand-confirm.js +1 -206
- package/dist/knowledge/demand-context.d.ts +17 -0
- package/dist/knowledge/demand-context.js +1 -0
- package/dist/knowledge/demand-ledger.d.ts +26 -0
- package/dist/knowledge/demand-ledger.js +1 -0
- package/dist/knowledge/demand-matching.js +1 -132
- package/dist/knowledge/demand-puzzle.d.ts +29 -0
- package/dist/knowledge/demand-puzzle.js +1 -0
- package/dist/knowledge/demand-risk.js +1 -240
- package/dist/knowledge/demand-templates.d.ts +12 -0
- package/dist/knowledge/demand-templates.js +1 -0
- package/dist/knowledge/demand-translation.js +1 -354
- package/dist/knowledge/deployment-scanner.js +1 -823
- package/dist/knowledge/dynamic-pricing.js +1 -87
- package/dist/knowledge/evidence-review.d.ts +12 -0
- package/dist/knowledge/evidence-review.js +1 -0
- package/dist/knowledge/examples-scanner-cli.js +1 -26
- package/dist/knowledge/examples-scanner.js +1 -843
- package/dist/knowledge/flywheel-loop.d.ts +0 -1
- package/dist/knowledge/flywheel-loop.js +1 -404
- package/dist/knowledge/fund-layer.js +1 -973
- package/dist/knowledge/glossary.js +1 -211
- package/dist/knowledge/guard-confirm.js +1 -406
- package/dist/knowledge/guard-context.js +1 -287
- package/dist/knowledge/guard-design-patterns.js +1 -360
- package/dist/knowledge/guard-ledger.js +1 -260
- package/dist/knowledge/guard-lint.js +1 -670
- package/dist/knowledge/guard-migration.d.ts +1 -1
- package/dist/knowledge/guard-migration.js +1 -228
- package/dist/knowledge/guard-puzzle.js +1 -805
- package/dist/knowledge/guard-render.js +1 -700
- package/dist/knowledge/guard-risk.js +1 -1879
- package/dist/knowledge/guard-submission-prompt.js +1 -171
- package/dist/knowledge/guard-templates.js +1 -1105
- package/dist/knowledge/guard-translation.js +1 -1119
- package/dist/knowledge/index.d.ts +71 -3
- package/dist/knowledge/index.js +1 -436
- package/dist/knowledge/industry-evolution.js +1 -323
- package/dist/knowledge/industry-generalizer.js +1 -381
- package/dist/knowledge/industry-registry.js +1 -174
- package/dist/knowledge/intent-metrics.d.ts +4 -3
- package/dist/knowledge/intent-metrics.js +1 -566
- package/dist/knowledge/machine-confirm.js +1 -559
- package/dist/knowledge/machine-context.js +1 -833
- package/dist/knowledge/machine-ledger.js +1 -338
- package/dist/knowledge/machine-puzzle.js +1 -494
- package/dist/knowledge/machine-render.js +1 -565
- package/dist/knowledge/machine-risk.js +1 -669
- package/dist/knowledge/machine-templates.js +1 -1597
- package/dist/knowledge/machine-topology.js +1 -234
- package/dist/knowledge/machine-translation.js +1 -513
- package/dist/knowledge/market-metrics.d.ts +12 -0
- package/dist/knowledge/market-metrics.js +1 -0
- package/dist/knowledge/market-operations.d.ts +46 -0
- package/dist/knowledge/market-operations.js +1 -0
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
- package/dist/knowledge/mcp-schema-audit.d.ts +22 -22
- package/dist/knowledge/mcp-schema-audit.js +1 -777
- package/dist/knowledge/onchain-constants.js +1 -35
- package/dist/knowledge/order-confirm.js +1 -573
- package/dist/knowledge/order-context.js +1 -390
- package/dist/knowledge/order-ledger.js +1 -341
- package/dist/knowledge/order-puzzle.js +1 -255
- package/dist/knowledge/order-risk.js +1 -653
- package/dist/knowledge/order-templates.js +1 -368
- package/dist/knowledge/order-translation.js +1 -550
- package/dist/knowledge/overrides-loader.js +1 -65
- package/dist/knowledge/passport-confirm.js +1 -531
- package/dist/knowledge/passport-context.js +1 -306
- package/dist/knowledge/passport-ledger.js +1 -282
- package/dist/knowledge/passport-puzzle.js +1 -333
- package/dist/knowledge/passport-risk.js +1 -450
- package/dist/knowledge/passport-templates.js +1 -568
- package/dist/knowledge/passport-translation.js +1 -516
- package/dist/knowledge/payment-confirm.d.ts +26 -0
- package/dist/knowledge/payment-confirm.js +1 -0
- package/dist/knowledge/payment-risk.js +1 -249
- package/dist/knowledge/payment-translation.d.ts +37 -0
- package/dist/knowledge/payment-translation.js +1 -0
- package/dist/knowledge/permission-confirm.js +1 -426
- package/dist/knowledge/permission-context.js +1 -224
- package/dist/knowledge/permission-ledger.d.ts +11 -0
- package/dist/knowledge/permission-ledger.js +1 -403
- package/dist/knowledge/permission-puzzle.js +1 -173
- package/dist/knowledge/permission-risk.js +1 -411
- package/dist/knowledge/permission-templates.js +1 -234
- package/dist/knowledge/permission-translation.js +1 -350
- package/dist/knowledge/personal-confirm.d.ts +29 -0
- package/dist/knowledge/personal-confirm.js +1 -0
- package/dist/knowledge/personal-risk.js +1 -212
- package/dist/knowledge/personal-translation.d.ts +37 -0
- package/dist/knowledge/personal-translation.js +1 -0
- package/dist/knowledge/process-model.d.ts +1 -11
- package/dist/knowledge/process-model.js +1 -160
- package/dist/knowledge/progress-confirm.js +1 -456
- package/dist/knowledge/progress-context.js +1 -452
- package/dist/knowledge/progress-ledger.js +1 -330
- package/dist/knowledge/progress-puzzle.js +1 -219
- package/dist/knowledge/progress-risk.js +1 -461
- package/dist/knowledge/progress-templates.js +1 -228
- package/dist/knowledge/progress-translation.js +1 -405
- package/dist/knowledge/proof-confirm.js +1 -187
- package/dist/knowledge/proof-context.d.ts +17 -0
- package/dist/knowledge/proof-context.js +1 -0
- package/dist/knowledge/proof-ledger.d.ts +34 -0
- package/dist/knowledge/proof-ledger.js +1 -0
- package/dist/knowledge/proof-puzzle.d.ts +35 -0
- package/dist/knowledge/proof-puzzle.js +1 -0
- package/dist/knowledge/proof-risk.js +1 -207
- package/dist/knowledge/proof-templates.d.ts +22 -0
- package/dist/knowledge/proof-templates.js +1 -0
- package/dist/knowledge/proof-translation.js +1 -283
- package/dist/knowledge/registrar-confirm.d.ts +26 -0
- package/dist/knowledge/registrar-confirm.js +1 -0
- package/dist/knowledge/registrar-risk.js +1 -217
- package/dist/knowledge/registrar-translation.d.ts +37 -0
- package/dist/knowledge/registrar-translation.js +1 -0
- package/dist/knowledge/repository-confirm.js +1 -286
- package/dist/knowledge/repository-context.d.ts +12 -0
- package/dist/knowledge/repository-context.js +1 -0
- package/dist/knowledge/repository-ledger.d.ts +25 -0
- package/dist/knowledge/repository-ledger.js +1 -0
- package/dist/knowledge/repository-puzzle.d.ts +30 -0
- package/dist/knowledge/repository-puzzle.js +1 -0
- package/dist/knowledge/repository-risk.js +1 -373
- package/dist/knowledge/repository-templates.d.ts +14 -0
- package/dist/knowledge/repository-templates.js +1 -0
- package/dist/knowledge/repository-translation.js +1 -445
- package/dist/knowledge/reputation-rules.js +1 -99
- package/dist/knowledge/resource-confirm.d.ts +25 -0
- package/dist/knowledge/resource-confirm.js +1 -0
- package/dist/knowledge/resource-risk.js +1 -157
- package/dist/knowledge/resource-translation.d.ts +37 -0
- package/dist/knowledge/resource-translation.js +1 -0
- package/dist/knowledge/reward-confirm.js +1 -526
- package/dist/knowledge/reward-context.d.ts +2 -2
- package/dist/knowledge/reward-context.js +1 -504
- package/dist/knowledge/reward-ledger.js +1 -502
- package/dist/knowledge/reward-puzzle.js +1 -300
- package/dist/knowledge/reward-risk.js +1 -627
- package/dist/knowledge/reward-templates.js +1 -197
- package/dist/knowledge/reward-translation.js +1 -501
- package/dist/knowledge/safety-rules.d.ts +1 -0
- package/dist/knowledge/safety-rules.js +1 -404
- package/dist/knowledge/scenario-modes.js +1 -321
- package/dist/knowledge/service-confirm.js +1 -807
- package/dist/knowledge/service-context.js +1 -403
- package/dist/knowledge/service-ledger.js +1 -609
- package/dist/knowledge/service-puzzle.js +1 -236
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +1 -651
- package/dist/knowledge/service-templates.js +1 -456
- package/dist/knowledge/service-translation.js +1 -622
- package/dist/knowledge/template-registry.js +1 -353
- package/dist/knowledge/tool-constraints.js +1 -195
- package/dist/knowledge/tools-reference.js +1 -178
- package/dist/knowledge/treasury-confirm.js +1 -512
- package/dist/knowledge/treasury-context.js +1 -363
- package/dist/knowledge/treasury-ledger.js +1 -300
- package/dist/knowledge/treasury-puzzle.js +1 -216
- package/dist/knowledge/treasury-risk.js +1 -440
- package/dist/knowledge/treasury-templates.js +1 -358
- package/dist/knowledge/treasury-translation.js +1 -498
- package/dist/knowledge/trust-metrics.js +1 -198
- package/dist/knowledge/universal-template.d.ts +22 -0
- package/dist/knowledge/universal-template.js +1 -0
- package/dist/knowledge/util-confirm.d.ts +24 -0
- package/dist/knowledge/util-confirm.js +1 -0
- package/dist/knowledge/util-risk.js +1 -135
- package/dist/knowledge/util-translation.d.ts +38 -0
- package/dist/knowledge/util-translation.js +1 -0
- package/dist/knowledge/workflow-guidance.d.ts +116 -0
- package/dist/knowledge/workflow-guidance.js +1 -0
- package/dist/loop-engineering/aggregate.js +1 -132
- package/dist/loop-engineering/context-collect.js +1 -83
- package/dist/loop-engineering/diagnose.js +1 -273
- package/dist/loop-engineering/improve.js +1 -405
- package/dist/loop-engineering/index.js +1 -4
- package/dist/loop-engineering/pipeline.js +1 -56
- package/dist/mode-market/index.js +1 -3
- package/dist/mode-market/registry.js +1 -124
- package/dist/mode-market/review.js +1 -214
- package/dist/mode-market/submission.js +1 -85
- package/dist/participation/collaborator-interest.d.ts +23 -0
- package/dist/participation/collaborator-interest.js +1 -0
- package/dist/participation/customer-interest.d.ts +25 -0
- package/dist/participation/customer-interest.js +1 -0
- package/dist/participation/employee-kpi.d.ts +25 -0
- package/dist/participation/employee-kpi.js +1 -0
- package/dist/participation/employee-store.d.ts +16 -0
- package/dist/participation/employee-store.js +1 -0
- package/dist/participation/index.d.ts +2 -0
- package/dist/participation/index.js +1 -0
- package/dist/participation/merchant-interest.js +1 -100
- package/dist/participation/radar-core.d.ts +13 -3
- package/dist/participation/radar-core.js +1 -269
- package/dist/participation/supplier-interest.d.ts +25 -0
- package/dist/participation/supplier-interest.js +1 -0
- package/dist/persona/analyzer.js +1 -66
- package/dist/persona/bridge.js +1 -86
- package/dist/persona/defaults.js +1 -195
- package/dist/persona/experience-bridge.js +1 -23
- package/dist/persona/index.d.ts +9 -2
- package/dist/persona/index.js +1 -71
- package/dist/persona/local-region.d.ts +20 -0
- package/dist/persona/local-region.js +1 -0
- package/dist/persona/model.js +1 -111
- package/dist/persona/overrides.d.ts +10 -0
- package/dist/persona/overrides.js +1 -0
- package/dist/persona/pack-personae.d.ts +11 -0
- package/dist/persona/pack-personae.js +1 -0
- package/dist/persona/store.js +1 -62
- package/dist/persona/strategy-intent.d.ts +20 -0
- package/dist/persona/strategy-intent.js +1 -0
- package/dist/persona/types.d.ts +6 -2
- package/dist/persona/types.js +1 -5
- package/dist/project/business-puzzle.d.ts +1 -1
- package/dist/project/business-puzzle.js +1 -383
- package/dist/project/context-assembly.js +1 -254
- package/dist/project/deployment-bridge.js +1 -120
- package/dist/project/deployment-doc.js +1 -1126
- package/dist/project/edit-planner.js +1 -1342
- package/dist/project/evaluation.d.ts +37 -1
- package/dist/project/evaluation.js +1 -2011
- package/dist/project/game-theory.js +1 -177
- package/dist/project/graph-builder.js +1 -656
- package/dist/project/graph.d.ts +3 -6
- package/dist/project/graph.js +1 -340
- package/dist/project/handlers.d.ts +33 -2
- package/dist/project/handlers.js +1 -1784
- package/dist/project/index.d.ts +2 -0
- package/dist/project/index.js +1 -301
- package/dist/project/intent-analyzer.js +1 -149
- package/dist/project/machine-nodes.js +1 -36
- package/dist/project/merchant-guide.d.ts +19 -0
- package/dist/project/merchant-guide.js +1 -264
- package/dist/project/migration.js +1 -125
- package/dist/project/mode-actions.js +1 -309
- package/dist/project/namespace.js +1 -206
- package/dist/project/participation-radar.js +1 -428
- package/dist/project/pipeline-actions.js +1 -109
- package/dist/project/project-store.js +1 -422
- package/dist/project/query.js +1 -153
- package/dist/project/reverse-mapping.d.ts +34 -0
- package/dist/project/reverse-mapping.js +1 -0
- package/dist/project/risk-aggregator.js +1 -295
- package/dist/project/rollback-policy.js +1 -290
- package/dist/project/semantic-assembler.js +1 -345
- package/dist/project/semantic-graph.d.ts +3 -5
- package/dist/project/semantic-graph.js +1 -292
- package/dist/project/stage-gate.js +1 -369
- package/dist/project/substep-trace.js +1 -332
- package/dist/project/task-tracker.js +1 -78
- package/dist/project/workflow-design-assessment.d.ts +24 -0
- package/dist/project/workflow-design-assessment.js +1 -0
- package/dist/role/derivation.d.ts +18 -0
- package/dist/role/derivation.js +1 -0
- package/dist/role/index.d.ts +5 -0
- package/dist/role/index.js +1 -0
- package/dist/role/model.d.ts +8 -0
- package/dist/role/model.js +1 -0
- package/dist/role/resolution.d.ts +11 -0
- package/dist/role/resolution.js +1 -0
- package/dist/role/types.d.ts +11 -0
- package/dist/role/types.js +1 -0
- package/dist/rules.js +1 -52
- package/dist/safety/confirm-gate.d.ts +1 -1
- package/dist/safety/confirm-gate.js +1 -88
- package/dist/safety/index.js +1 -3
- package/dist/safety/preview.js +1 -52
- package/dist/schema/call/allocation.d.ts +186 -1385
- package/dist/schema/call/allocation.js +1 -34
- package/dist/schema/call/arbitration.d.ts +272 -1871
- package/dist/schema/call/arbitration.js +1 -113
- package/dist/schema/call/base.d.ts +1831 -9076
- package/dist/schema/call/base.js +1 -370
- package/dist/schema/call/bridge.d.ts +911 -3171
- package/dist/schema/call/bridge.js +1 -458
- package/dist/schema/call/contact.d.ts +135 -931
- package/dist/schema/call/contact.js +1 -37
- package/dist/schema/call/demand.d.ts +164 -1194
- package/dist/schema/call/demand.js +1 -47
- package/dist/schema/call/guard.d.ts +298 -1140
- package/dist/schema/call/guard.js +1 -161
- package/dist/schema/call/handler.js +1 -322
- package/dist/schema/call/index.js +1 -20
- package/dist/schema/call/machine.d.ts +459 -5403
- package/dist/schema/call/machine.js +1 -193
- package/dist/schema/call/order.d.ts +137 -844
- package/dist/schema/call/order.js +1 -35
- package/dist/schema/call/payment.d.ts +74 -561
- package/dist/schema/call/payment.js +1 -37
- package/dist/schema/call/permission-handler.js +1 -54
- package/dist/schema/call/permission.d.ts +335 -2791
- package/dist/schema/call/permission.js +1 -105
- package/dist/schema/call/personal.d.ts +227 -1814
- package/dist/schema/call/personal.js +1 -78
- package/dist/schema/call/progress.d.ts +140 -843
- package/dist/schema/call/progress.js +1 -47
- package/dist/schema/call/proof.d.ts +42 -258
- package/dist/schema/call/proof.js +1 -33
- package/dist/schema/call/repository.d.ts +324 -2222
- package/dist/schema/call/repository.js +1 -77
- package/dist/schema/call/reward.d.ts +153 -1183
- package/dist/schema/call/reward.js +1 -30
- package/dist/schema/call/semantic.js +1 -1679
- package/dist/schema/call/service.d.ts +376 -3431
- package/dist/schema/call/service.js +1 -184
- package/dist/schema/call/treasury.d.ts +252 -2158
- package/dist/schema/call/treasury.js +1 -71
- package/dist/schema/common/index.d.ts +222 -697
- package/dist/schema/common/index.js +1 -407
- package/dist/schema/config/index.d.ts +18 -161
- package/dist/schema/config/index.js +1 -68
- package/dist/schema/employee/index.d.ts +99 -0
- package/dist/schema/employee/index.js +1 -0
- package/dist/schema/evaluation/index.d.ts +1062 -3748
- package/dist/schema/evaluation/index.js +1 -356
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.js +1 -17
- package/dist/schema/industry-pack/index.d.ts +132 -0
- package/dist/schema/industry-pack/index.js +1 -0
- package/dist/schema/intent-radar/index.d.ts +92 -245
- package/dist/schema/intent-radar/index.js +1 -89
- package/dist/schema/local/index.d.ts +2045 -18080
- package/dist/schema/local/index.js +1 -927
- package/dist/schema/local/wip.d.ts +61 -651
- package/dist/schema/local/wip.js +1 -187
- package/dist/schema/messenger/index.d.ts +949 -5557
- package/dist/schema/messenger/index.js +1 -475
- package/dist/schema/operations.d.ts +2969 -26518
- package/dist/schema/operations.js +1 -520
- package/dist/schema/persona/index.d.ts +469 -1820
- package/dist/schema/persona/index.js +1 -148
- package/dist/schema/project/index.d.ts +1027 -8408
- package/dist/schema/project/index.js +1 -2057
- package/dist/schema/query/index.d.ts +12041 -75261
- package/dist/schema/query/index.js +1 -1646
- package/dist/schema/schema-query/index.d.ts +35 -98
- package/dist/schema/schema-query/index.js +1 -104
- package/dist/schema/schema-version.js +1 -76
- package/dist/schema/task-status.d.ts +26 -132
- package/dist/schema/task-status.js +1 -36
- package/dist/schema/trust/index.d.ts +194 -1290
- package/dist/schema/trust/index.js +1 -314
- package/dist/schema/utils/guard-parser.js +1 -419
- package/dist/schema/utils/guard-query-utils.js +1 -46
- package/dist/schema/utils/node-parser.js +1 -369
- package/dist/schema/utils/object-type-utils.js +1 -35
- package/dist/schema/utils/permission-index-utils.js +1 -7
- package/dist/schema/utils/permission-machine-check.js +1 -121
- package/dist/schema/utils/skills-recommendation.d.ts +1 -0
- package/dist/schema/utils/skills-recommendation.js +1 -77
- package/dist/schema/workspace/index.d.ts +69 -0
- package/dist/schema/workspace/index.js +1 -0
- package/dist/schema-query-impl/index.js +1 -0
- package/dist/schemas/account_operation.output.json +3147 -1652
- package/dist/schemas/account_operation.schema.json +225 -218
- package/dist/schemas/bridge_operation.output.json +1168 -650
- package/dist/schemas/bridge_operation.schema.json +736 -504
- package/dist/schemas/config_operation.output.json +185 -179
- package/dist/schemas/config_operation.schema.json +21 -26
- package/dist/schemas/employee_operation.output.json +207 -0
- package/dist/schemas/employee_operation.schema.json +176 -0
- package/dist/schemas/evaluation_operation.output.json +2329 -557
- package/dist/schemas/evaluation_operation.schema.json +2939 -720
- package/dist/schemas/guard2file.output.json +58 -64
- package/dist/schemas/guard2file.schema.json +79 -81
- package/dist/schemas/index.json +29 -11
- package/dist/schemas/industry_pack_operation.output.json +594 -0
- package/dist/schemas/industry_pack_operation.schema.json +55 -0
- package/dist/schemas/intent_radar.output.json +275 -200
- package/dist/schemas/intent_radar.schema.json +124 -123
- package/dist/schemas/local_info_operation.output.json +1174 -657
- package/dist/schemas/local_info_operation.schema.json +119 -125
- package/dist/schemas/local_mark_operation.output.json +1239 -689
- package/dist/schemas/local_mark_operation.schema.json +91 -96
- package/dist/schemas/machineNode2file.output.json +63 -69
- package/dist/schemas/machineNode2file.schema.json +79 -81
- package/dist/schemas/messenger_operation.output.json +2722 -1528
- package/dist/schemas/messenger_operation.schema.json +1482 -1264
- package/dist/schemas/onchain_events.output.json +2590 -975
- package/dist/schemas/onchain_events.schema.json +117 -99
- package/dist/schemas/onchain_operations.output.json +3957 -2309
- package/dist/schemas/onchain_operations.schema.json +20799 -9285
- package/dist/schemas/onchain_operations_allocation.schema.json +172 -108
- package/dist/schemas/onchain_operations_arbitration.schema.json +233 -146
- package/dist/schemas/onchain_operations_contact.schema.json +129 -90
- package/dist/schemas/onchain_operations_demand.schema.json +170 -112
- package/dist/schemas/onchain_operations_gen_passport.schema.json +61 -646
- package/dist/schemas/onchain_operations_gen_proof.schema.json +40 -172
- package/dist/schemas/onchain_operations_guard.schema.json +3765 -294
- package/dist/schemas/onchain_operations_machine.schema.json +537 -164
- package/dist/schemas/onchain_operations_order.schema.json +126 -96
- package/dist/schemas/onchain_operations_payment.schema.json +82 -67
- package/dist/schemas/onchain_operations_permission.schema.json +331 -93
- package/dist/schemas/onchain_operations_personal.schema.json +636 -96
- package/dist/schemas/onchain_operations_progress.schema.json +125 -92
- package/dist/schemas/onchain_operations_proof.schema.json +76 -69
- package/dist/schemas/onchain_operations_repository.schema.json +636 -249
- package/dist/schemas/onchain_operations_reward.schema.json +218 -108
- package/dist/schemas/onchain_operations_service.schema.json +679 -221
- package/dist/schemas/onchain_operations_treasury.schema.json +401 -135
- package/dist/schemas/onchain_table_data.output.json +6018 -2430
- package/dist/schemas/onchain_table_data.schema.json +544 -430
- package/dist/schemas/persona_operation.output.json +1568 -265
- package/dist/schemas/persona_operation.schema.json +346 -202
- package/dist/schemas/project_operation.output.json +6957 -5147
- package/dist/schemas/project_operation.schema.json +1050 -1020
- package/dist/schemas/query_task_status.output.json +195 -99
- package/dist/schemas/query_task_status.schema.json +12 -18
- package/dist/schemas/query_toolkit.output.json +18870 -14566
- package/dist/schemas/query_toolkit.schema.json +614 -522
- package/dist/schemas/schema_query.output.json +127 -129
- package/dist/schemas/schema_query.schema.json +64 -69
- package/dist/schemas/trust_score.output.json +678 -587
- package/dist/schemas/trust_score.schema.json +289 -277
- package/dist/schemas/wip_file.output.json +116 -124
- package/dist/schemas/wip_file.schema.json +142 -143
- package/dist/schemas/workspace_operation.output.json +277 -0
- package/dist/schemas/workspace_operation.schema.json +45 -0
- package/dist/schemas/wowok_buildin_info.output.json +1693 -723
- package/dist/schemas/wowok_buildin_info.schema.json +576 -512
- package/dist/telemetry/index.js +1 -112
- package/dist/telemetry/redact.js +1 -23
- package/dist/telemetry/storage.js +1 -80
- package/dist/tools/handlers/bridge.d.ts +8 -1
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -74
- package/dist/tools/handlers/employee.d.ts +2 -0
- package/dist/tools/handlers/employee.js +1 -0
- package/dist/tools/handlers/evaluation.js +1 -123
- package/dist/tools/handlers/file-export.js +1 -90
- package/dist/tools/handlers/industry-pack.d.ts +2 -0
- package/dist/tools/handlers/industry-pack.js +1 -0
- package/dist/tools/handlers/intent-radar.js +1 -76
- package/dist/tools/handlers/local.js +1 -53
- package/dist/tools/handlers/messenger.js +1 -188
- package/dist/tools/handlers/onchain.js +1 -1180
- package/dist/tools/handlers/persona.js +1 -89
- package/dist/tools/handlers/project.js +1 -211
- package/dist/tools/handlers/query.js +1 -434
- package/dist/tools/handlers/schema-query.js +1 -176
- package/dist/tools/handlers/task-status.js +1 -26
- package/dist/tools/handlers/trust.js +1 -380
- package/dist/tools/handlers/wip.js +1 -90
- package/dist/tools/handlers/workspace.d.ts +2 -0
- package/dist/tools/handlers/workspace.js +1 -0
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.js +1 -1382
- package/dist/tools/retry.js +1 -85
- package/dist/tools/rules-hook.d.ts +1 -1
- package/dist/tools/rules-hook.js +1 -23
- package/dist/tools/shared.d.ts +1 -1
- package/dist/tools/shared.js +1 -130
- package/dist/tools/types.d.ts +2 -1
- package/dist/tools/types.js +1 -1
- package/dist/tools/upgrade-check.d.ts +19 -0
- package/dist/tools/upgrade-check.js +1 -0
- package/dist/tools/wip-deploy-assist.js +1 -306
- package/dist/tools/wrap.js +1 -500
- package/package.json +7 -6
- package/dist/knowledge/arbitration-trust.d.ts +0 -24
- package/dist/knowledge/arbitration-trust.js +0 -117
- package/dist/schema/call/bridge-handler.d.ts +0 -8
- package/dist/schema/call/bridge-handler.js +0 -265
- package/dist/schema/sync-layer4.d.ts +0 -21
- package/dist/schema/sync-layer4.js +0 -286
- package/dist/schema-query/index.js +0 -810
- /package/dist/{schema-query → schema-query-impl}/index.d.ts +0 -0
package/dist/harness/plan.js
CHANGED
|
@@ -1,315 +1 @@
|
|
|
1
|
-
export const SCENARIO_REGISTRY = [
|
|
2
|
-
{
|
|
3
|
-
name: "freelance",
|
|
4
|
-
keywords: ["freelance", "service", "deliverable", "client", "gig", "consult", "design", "develop"],
|
|
5
|
-
description: "Service delivery with escrow: publish → order → deliver → accept → withdraw",
|
|
6
|
-
default_permissions: { provider: 1000, customer: "namedOperator", arbiter: 1500 },
|
|
7
|
-
objects: [
|
|
8
|
-
{ type: "Permission", reversible: true, dependencies: [], user_decisions: ["reuse existing or create new?"], estimated_time: "2min" },
|
|
9
|
-
{ type: "Service", reversible: true, dependencies: ["Permission"], user_decisions: ["name", "description", "token_type"], estimated_time: "3min" },
|
|
10
|
-
{ type: "Machine", reversible: true, dependencies: ["Service"], user_decisions: ["state graph", "operators"], estimated_time: "10min" },
|
|
11
|
-
{ type: "Guard", reversible: false, dependencies: ["Machine"], user_decisions: ["guard table", "submission fields"], risk_flags: ["immutable_after_creation"], estimated_time: "5min" },
|
|
12
|
-
{ type: "Guard", reversible: false, dependencies: ["Machine"], user_decisions: ["refund guard"], risk_flags: ["immutable_after_creation"], estimated_time: "5min" },
|
|
13
|
-
{ type: "Allocation", reversible: true, dependencies: ["Service", "Guard"], user_decisions: ["sharing ratios", "allocators"], estimated_time: "5min" },
|
|
14
|
-
],
|
|
15
|
-
phases: [
|
|
16
|
-
{ name: "Foundation", object_types: ["Permission", "Service"] },
|
|
17
|
-
{ name: "Business Logic", object_types: ["Machine"] },
|
|
18
|
-
{ name: "Trust Layer", object_types: ["Guard"] },
|
|
19
|
-
{ name: "Revenue", object_types: ["Allocation"] },
|
|
20
|
-
{ name: "Publish", object_types: ["Service"] },
|
|
21
|
-
],
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
name: "rental",
|
|
25
|
-
keywords: ["rent", "rental", "lease", "property", "item", "deposit", "tenant", "landlord"],
|
|
26
|
-
description: "Item rental with deposit: publish → rent → inspect → return/refund",
|
|
27
|
-
default_permissions: { provider: 1000, customer: "namedOperator", arbiter: 1500 },
|
|
28
|
-
objects: [
|
|
29
|
-
{ type: "Permission", reversible: true, dependencies: [], user_decisions: ["reuse existing or create new?"], estimated_time: "2min" },
|
|
30
|
-
{ type: "Service", reversible: true, dependencies: ["Permission"], user_decisions: ["name", "deposit amount", "rental terms"], estimated_time: "3min" },
|
|
31
|
-
{ type: "Machine", reversible: true, dependencies: ["Service"], user_decisions: ["rental states", "return/inspect flow"], estimated_time: "10min" },
|
|
32
|
-
{ type: "Guard", reversible: false, dependencies: ["Machine"], user_decisions: ["return guard", "damage guard"], risk_flags: ["immutable_after_creation"], estimated_time: "5min" },
|
|
33
|
-
{ type: "Guard", reversible: false, dependencies: ["Machine"], user_decisions: ["refund guard"], risk_flags: ["immutable_after_creation"], estimated_time: "5min" },
|
|
34
|
-
{ type: "Allocation", reversible: true, dependencies: ["Service", "Guard"], user_decisions: ["deposit/refund allocation", "damage compensation"], estimated_time: "5min" },
|
|
35
|
-
],
|
|
36
|
-
phases: [
|
|
37
|
-
{ name: "Foundation", object_types: ["Permission", "Service"] },
|
|
38
|
-
{ name: "Business Logic", object_types: ["Machine"] },
|
|
39
|
-
{ name: "Trust Layer", object_types: ["Guard"] },
|
|
40
|
-
{ name: "Revenue", object_types: ["Allocation"] },
|
|
41
|
-
{ name: "Publish", object_types: ["Service"] },
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
name: "retail",
|
|
46
|
-
keywords: ["retail", "shop", "store", "ecommerce", "buy", "sell", "product", "digital", "download", "ebook", "software", "license", "instant", "content"],
|
|
47
|
-
description: "Instant digital delivery: publish → buy → instant delivery",
|
|
48
|
-
default_permissions: { provider: 1000, customer: "namedOperator" },
|
|
49
|
-
objects: [
|
|
50
|
-
{ type: "Permission", reversible: true, dependencies: [], estimated_time: "2min" },
|
|
51
|
-
{ type: "Service", reversible: true, dependencies: ["Permission"], user_decisions: ["name", "price", "delivery method"], estimated_time: "3min" },
|
|
52
|
-
{ type: "Machine", reversible: true, dependencies: ["Service"], user_decisions: ["instant delivery states"], estimated_time: "5min" },
|
|
53
|
-
{ type: "Allocation", reversible: true, dependencies: ["Service"], user_decisions: ["revenue split"], estimated_time: "3min" },
|
|
54
|
-
],
|
|
55
|
-
phases: [
|
|
56
|
-
{ name: "Foundation", object_types: ["Permission", "Service"] },
|
|
57
|
-
{ name: "Business Logic", object_types: ["Machine"] },
|
|
58
|
-
{ name: "Revenue", object_types: ["Allocation"] },
|
|
59
|
-
{ name: "Publish", object_types: ["Service"] },
|
|
60
|
-
],
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: "travel",
|
|
64
|
-
keywords: ["travel", "tour", "trip", "package", "booking", "itinerary", "vacation", "hotel"],
|
|
65
|
-
description: "Multi-stage service with milestones: publish → book → itinerary → complete",
|
|
66
|
-
default_permissions: { provider: 1000, customer: "namedOperator", arbiter: 1500 },
|
|
67
|
-
objects: [
|
|
68
|
-
{ type: "Permission", reversible: true, dependencies: [], estimated_time: "2min" },
|
|
69
|
-
{ type: "Service", reversible: true, dependencies: ["Permission"], user_decisions: ["name", "package details", "pricing tiers"], estimated_time: "5min" },
|
|
70
|
-
{ type: "Machine", reversible: true, dependencies: ["Service"], user_decisions: ["booking states", "milestone flow", "cancellation"], estimated_time: "15min" },
|
|
71
|
-
{ type: "Guard", reversible: false, dependencies: ["Machine"], user_decisions: ["booking guard", "cancellation guard"], risk_flags: ["immutable_after_creation"], estimated_time: "5min" },
|
|
72
|
-
{ type: "Allocation", reversible: true, dependencies: ["Service", "Guard"], user_decisions: ["milestone payments", "refund policy"], estimated_time: "5min" },
|
|
73
|
-
],
|
|
74
|
-
phases: [
|
|
75
|
-
{ name: "Foundation", object_types: ["Permission", "Service"] },
|
|
76
|
-
{ name: "Business Logic", object_types: ["Machine"] },
|
|
77
|
-
{ name: "Trust Layer", object_types: ["Guard"] },
|
|
78
|
-
{ name: "Revenue", object_types: ["Allocation"] },
|
|
79
|
-
{ name: "Publish", object_types: ["Service"] },
|
|
80
|
-
],
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
name: "education",
|
|
84
|
-
keywords: ["education", "course", "training", "tutor", "teach", "learn", "school", "coach", "class", "lesson"],
|
|
85
|
-
description: "Long-cycle education with milestones: publish → enroll → teach → complete → certificate",
|
|
86
|
-
default_permissions: { provider: 1000, customer: "namedOperator", arbiter: 1500 },
|
|
87
|
-
objects: [
|
|
88
|
-
{ type: "Permission", reversible: true, dependencies: [], user_decisions: ["reuse existing or create new?"], estimated_time: "2min" },
|
|
89
|
-
{ type: "Service", reversible: true, dependencies: ["Permission"], user_decisions: ["name", "course details", "token_type"], estimated_time: "3min" },
|
|
90
|
-
{ type: "Machine", reversible: true, dependencies: ["Service"], user_decisions: ["enrollment states", "milestone flow", "completion"], estimated_time: "15min" },
|
|
91
|
-
{ type: "Guard", reversible: false, dependencies: ["Machine"], user_decisions: ["enrollment guard", "completion guard"], risk_flags: ["immutable_after_creation"], estimated_time: "5min" },
|
|
92
|
-
{ type: "Guard", reversible: false, dependencies: ["Machine"], user_decisions: ["refund guard"], risk_flags: ["immutable_after_creation"], estimated_time: "5min" },
|
|
93
|
-
{ type: "Allocation", reversible: true, dependencies: ["Service", "Guard"], user_decisions: ["milestone payments", "refund policy"], estimated_time: "5min" },
|
|
94
|
-
],
|
|
95
|
-
phases: [
|
|
96
|
-
{ name: "Foundation", object_types: ["Permission", "Service"] },
|
|
97
|
-
{ name: "Business Logic", object_types: ["Machine"] },
|
|
98
|
-
{ name: "Trust Layer", object_types: ["Guard"] },
|
|
99
|
-
{ name: "Revenue", object_types: ["Allocation"] },
|
|
100
|
-
{ name: "Publish", object_types: ["Service"] },
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
name: "subscription",
|
|
105
|
-
keywords: ["subscription", "subscribe", "membership", "recurring", "monthly", "newsletter", "patreon", "tier"],
|
|
106
|
-
description: "Recurring subscription with renewal: publish → subscribe → renew → cancel",
|
|
107
|
-
default_permissions: { provider: 1000, customer: "namedOperator" },
|
|
108
|
-
objects: [
|
|
109
|
-
{ type: "Permission", reversible: true, dependencies: [], estimated_time: "2min" },
|
|
110
|
-
{ type: "Service", reversible: true, dependencies: ["Permission"], user_decisions: ["name", "subscription tiers", "token_type"], estimated_time: "3min" },
|
|
111
|
-
{ type: "Machine", reversible: true, dependencies: ["Service"], user_decisions: ["subscribe states", "renewal flow", "cancellation"], estimated_time: "10min" },
|
|
112
|
-
{ type: "Allocation", reversible: true, dependencies: ["Service"], user_decisions: ["revenue split"], estimated_time: "3min" },
|
|
113
|
-
],
|
|
114
|
-
phases: [
|
|
115
|
-
{ name: "Foundation", object_types: ["Permission", "Service"] },
|
|
116
|
-
{ name: "Business Logic", object_types: ["Machine"] },
|
|
117
|
-
{ name: "Revenue", object_types: ["Allocation"] },
|
|
118
|
-
{ name: "Publish", object_types: ["Service"] },
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: "general",
|
|
123
|
-
keywords: [],
|
|
124
|
-
description: "Fallback for unmatched scenarios — generic service template",
|
|
125
|
-
default_permissions: { provider: 1000, customer: "namedOperator" },
|
|
126
|
-
objects: [
|
|
127
|
-
{ type: "Permission", reversible: true, dependencies: [], estimated_time: "2min" },
|
|
128
|
-
{ type: "Service", reversible: true, dependencies: ["Permission"], user_decisions: ["name", "description", "token_type"], estimated_time: "3min" },
|
|
129
|
-
{ type: "Machine", reversible: true, dependencies: ["Service"], user_decisions: ["state graph"], estimated_time: "10min" },
|
|
130
|
-
{ type: "Guard", reversible: false, dependencies: ["Machine"], user_decisions: ["guard requirements"], risk_flags: ["immutable_after_creation"], estimated_time: "5min" },
|
|
131
|
-
{ type: "Allocation", reversible: true, dependencies: ["Service"], user_decisions: ["sharing"], estimated_time: "5min" },
|
|
132
|
-
],
|
|
133
|
-
phases: [
|
|
134
|
-
{ name: "Foundation", object_types: ["Permission", "Service"] },
|
|
135
|
-
{ name: "Business Logic", object_types: ["Machine"] },
|
|
136
|
-
{ name: "Trust Layer", object_types: ["Guard"] },
|
|
137
|
-
{ name: "Revenue", object_types: ["Allocation"] },
|
|
138
|
-
{ name: "Publish", object_types: ["Service"] },
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
];
|
|
142
|
-
export function classifyIntent(userInput) {
|
|
143
|
-
const lower = userInput.toLowerCase();
|
|
144
|
-
let bestMatch = null;
|
|
145
|
-
let bestScore = 0;
|
|
146
|
-
let matchedKeywords = [];
|
|
147
|
-
for (const scenario of SCENARIO_REGISTRY) {
|
|
148
|
-
if (scenario.keywords.length === 0)
|
|
149
|
-
continue;
|
|
150
|
-
const hits = scenario.keywords.filter((kw) => lower.includes(kw));
|
|
151
|
-
if (hits.length > bestScore) {
|
|
152
|
-
bestScore = hits.length;
|
|
153
|
-
bestMatch = scenario;
|
|
154
|
-
matchedKeywords = hits;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
if (bestMatch && bestScore > 0) {
|
|
158
|
-
const confidence = Math.min(bestScore / 3, 1.0);
|
|
159
|
-
return {
|
|
160
|
-
scenario: bestMatch.name,
|
|
161
|
-
matched_keywords: matchedKeywords,
|
|
162
|
-
confidence,
|
|
163
|
-
fallback: false,
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
return {
|
|
167
|
-
scenario: "general",
|
|
168
|
-
matched_keywords: [],
|
|
169
|
-
confidence: 0.3,
|
|
170
|
-
fallback: true,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
let nodeIdCounter = 0;
|
|
174
|
-
function nextNodeId(type) {
|
|
175
|
-
nodeIdCounter++;
|
|
176
|
-
return `${type.toLowerCase()}_${nodeIdCounter}`;
|
|
177
|
-
}
|
|
178
|
-
export function generateODG(userInput, taskId) {
|
|
179
|
-
const classification = classifyIntent(userInput);
|
|
180
|
-
const template = SCENARIO_REGISTRY.find((s) => s.name === classification.scenario) ?? SCENARIO_REGISTRY[SCENARIO_REGISTRY.length - 1];
|
|
181
|
-
const objects = template.objects.map((obj) => ({
|
|
182
|
-
id: nextNodeId(obj.type),
|
|
183
|
-
type: obj.type,
|
|
184
|
-
status: "not_created",
|
|
185
|
-
reversible: obj.reversible,
|
|
186
|
-
dependencies: [],
|
|
187
|
-
user_decisions: obj.user_decisions,
|
|
188
|
-
risk_flags: obj.risk_flags,
|
|
189
|
-
estimated_time: obj.estimated_time,
|
|
190
|
-
}));
|
|
191
|
-
const typeToLatestId = new Map();
|
|
192
|
-
for (const obj of objects) {
|
|
193
|
-
const depTypes = template.objects.find((t) => t.type === obj.type)?.dependencies ?? [];
|
|
194
|
-
obj.dependencies = depTypes
|
|
195
|
-
.map((depType) => typeToLatestId.get(depType))
|
|
196
|
-
.filter((id) => id !== undefined);
|
|
197
|
-
typeToLatestId.set(obj.type, obj.id);
|
|
198
|
-
}
|
|
199
|
-
const phases = template.phases.map((phase) => {
|
|
200
|
-
const phaseObjectIds = objects
|
|
201
|
-
.filter((obj) => phase.object_types.includes(obj.type))
|
|
202
|
-
.map((obj) => obj.id);
|
|
203
|
-
return { name: phase.name, objects: phaseObjectIds };
|
|
204
|
-
});
|
|
205
|
-
return {
|
|
206
|
-
task_id: taskId ?? `task_${Date.now()}`,
|
|
207
|
-
scenario: classification.scenario,
|
|
208
|
-
objects,
|
|
209
|
-
phases,
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
export function identifyDecisionPoints(odg) {
|
|
213
|
-
const decisions = [];
|
|
214
|
-
const scenario = SCENARIO_REGISTRY.find((s) => s.name === odg.scenario);
|
|
215
|
-
decisions.push({
|
|
216
|
-
round: "R1",
|
|
217
|
-
question: `I've classified your intent as "${odg.scenario}". Is this correct?`,
|
|
218
|
-
options: ["Yes, correct", "No, let me clarify"],
|
|
219
|
-
});
|
|
220
|
-
decisions.push({
|
|
221
|
-
round: "R2",
|
|
222
|
-
question: "Do you have existing Permission objects to reuse, or should I create a new one?",
|
|
223
|
-
options: ["Create new", "Reuse existing", "Show me what I have"],
|
|
224
|
-
});
|
|
225
|
-
decisions.push({
|
|
226
|
-
round: "R3",
|
|
227
|
-
question: "What is the service name, description, and pricing token?",
|
|
228
|
-
options: ["WOW (default)", "USDT", "USDC", "Custom token"],
|
|
229
|
-
default: "WOW (default)",
|
|
230
|
-
});
|
|
231
|
-
if (scenario?.default_permissions.arbiter) {
|
|
232
|
-
decisions.push({
|
|
233
|
-
round: "R4",
|
|
234
|
-
question: "Permission model: provider=1000, customer uses namedOperator, arbiter=1500. Adjust?",
|
|
235
|
-
options: ["Use defaults", "Customize"],
|
|
236
|
-
default: "Use defaults",
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
decisions.push({
|
|
240
|
-
round: "R5",
|
|
241
|
-
question: "What are the service states and transitions? (entry → states → terminals)",
|
|
242
|
-
options: ["Use scenario template", "Custom design"],
|
|
243
|
-
});
|
|
244
|
-
const guardNodes = odg.objects.filter((o) => o.type === "Guard");
|
|
245
|
-
if (guardNodes.length > 0) {
|
|
246
|
-
decisions.push({
|
|
247
|
-
round: "R6",
|
|
248
|
-
question: `${guardNodes.length} Guard(s) needed. What should each Guard verify?`,
|
|
249
|
-
options: ["Withdrawal guard", "Refund guard", "Delivery guard", "Custom"],
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
decisions.push({
|
|
253
|
-
round: "R7",
|
|
254
|
-
question: "How should revenue be split? (e.g., merchant 80%, platform 20%)",
|
|
255
|
-
options: ["100% to merchant", "80/20 split", "Custom split"],
|
|
256
|
-
default: "100% to merchant",
|
|
257
|
-
});
|
|
258
|
-
return decisions;
|
|
259
|
-
}
|
|
260
|
-
export function detectCycles(odg) {
|
|
261
|
-
const visited = new Set();
|
|
262
|
-
const stack = new Set();
|
|
263
|
-
const cycleNodes = [];
|
|
264
|
-
function dfs(nodeId, path) {
|
|
265
|
-
if (stack.has(nodeId)) {
|
|
266
|
-
const cycleStart = path.indexOf(nodeId);
|
|
267
|
-
cycleNodes.push(...path.slice(cycleStart), nodeId);
|
|
268
|
-
return true;
|
|
269
|
-
}
|
|
270
|
-
if (visited.has(nodeId))
|
|
271
|
-
return false;
|
|
272
|
-
visited.add(nodeId);
|
|
273
|
-
stack.add(nodeId);
|
|
274
|
-
const node = odg.objects.find((o) => o.id === nodeId);
|
|
275
|
-
if (node) {
|
|
276
|
-
for (const dep of node.dependencies) {
|
|
277
|
-
if (dfs(dep, [...path, nodeId]))
|
|
278
|
-
return true;
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
stack.delete(nodeId);
|
|
282
|
-
return false;
|
|
283
|
-
}
|
|
284
|
-
for (const obj of odg.objects) {
|
|
285
|
-
if (!visited.has(obj.id)) {
|
|
286
|
-
if (dfs(obj.id, []))
|
|
287
|
-
return cycleNodes;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
return null;
|
|
291
|
-
}
|
|
292
|
-
export function identifyMigrationDecisions(options) {
|
|
293
|
-
const current = options?.current_payment_token ?? "WOW";
|
|
294
|
-
const from = options?.from_network ?? "testnet";
|
|
295
|
-
const to = options?.to_network ?? "mainnet";
|
|
296
|
-
return [
|
|
297
|
-
{
|
|
298
|
-
round: "M1",
|
|
299
|
-
question: `Your project currently uses "${current}" as the payment token on ${from}. ` +
|
|
300
|
-
`When migrating to ${to}, do you want to keep "${current}" or switch to a stablecoin ` +
|
|
301
|
-
`(e.g. USDT, available via the ETH mainnet cross-chain bridge)?`,
|
|
302
|
-
options: [
|
|
303
|
-
`Keep ${current}`,
|
|
304
|
-
"Switch to USDT",
|
|
305
|
-
"Switch to USDC",
|
|
306
|
-
"Other stablecoin",
|
|
307
|
-
],
|
|
308
|
-
default: `Keep ${current}`,
|
|
309
|
-
note: `Testnet recommendation: WOW for all merchant and order testing. ` +
|
|
310
|
-
`Mainnet: USDT and other stablecoins are available via the ETH mainnet cross-chain bridge ` +
|
|
311
|
-
`and are often preferred to avoid price volatility. If switching, the Service / Treasury / ` +
|
|
312
|
-
`Allocation type_parameter must be updated to the stablecoin's WOW type tag before publishing on mainnet.`,
|
|
313
|
-
},
|
|
314
|
-
];
|
|
315
|
-
}
|
|
1
|
+
export const SCENARIO_REGISTRY=[{'name':'freelance','keywords':['freelance','service','deliverable','client','gig','consult','design','develop'],'description':'Service\x20delivery\x20with\x20escrow:\x20publish\x20→\x20order\x20→\x20deliver\x20→\x20accept\x20→\x20withdraw','default_permissions':{'provider':0x3e8,'customer':'namedOperator','arbiter':0x5dc},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'user_decisions':['reuse\x20existing\x20or\x20create\x20new?'],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','description','token_type'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['state\x20graph','operators'],'estimated_time':'10min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['guard\x20table','submission\x20fields'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['refund\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service','Guard'],'user_decisions':['sharing\x20ratios','allocators'],'estimated_time':'5min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Trust\x20Layer','object_types':['Guard']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'rental','keywords':['rent','rental','lease','property','item','deposit','tenant','landlord'],'description':'Item\x20rental\x20with\x20deposit:\x20publish\x20→\x20rent\x20→\x20inspect\x20→\x20return/refund','default_permissions':{'provider':0x3e8,'customer':'namedOperator','arbiter':0x5dc},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'user_decisions':['reuse\x20existing\x20or\x20create\x20new?'],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','deposit\x20amount','rental\x20terms'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['rental\x20states','return/inspect\x20flow'],'estimated_time':'10min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['return\x20guard','damage\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['refund\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service','Guard'],'user_decisions':['deposit/refund\x20allocation','damage\x20compensation'],'estimated_time':'5min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Trust\x20Layer','object_types':['Guard']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'retail','keywords':['retail','shop','store','ecommerce','buy','sell','product','digital','download','ebook','software','license','instant','content'],'description':'Instant\x20digital\x20delivery:\x20publish\x20→\x20buy\x20→\x20instant\x20delivery','default_permissions':{'provider':0x3e8,'customer':'namedOperator'},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','price','delivery\x20method'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['instant\x20delivery\x20states'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service'],'user_decisions':['revenue\x20split'],'estimated_time':'3min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'travel','keywords':['travel','tour','trip','package','booking','itinerary','vacation','hotel'],'description':'Multi-stage\x20service\x20with\x20milestones:\x20publish\x20→\x20book\x20→\x20itinerary\x20→\x20complete','default_permissions':{'provider':0x3e8,'customer':'namedOperator','arbiter':0x5dc},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','package\x20details','pricing\x20tiers'],'estimated_time':'5min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['booking\x20states','milestone\x20flow','cancellation'],'estimated_time':'15min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['booking\x20guard','cancellation\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service','Guard'],'user_decisions':['milestone\x20payments','refund\x20policy'],'estimated_time':'5min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Trust\x20Layer','object_types':['Guard']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'education','keywords':['education','course','training','tutor','teach','learn','school','coach','class','lesson'],'description':'Long-cycle\x20education\x20with\x20milestones:\x20publish\x20→\x20enroll\x20→\x20teach\x20→\x20complete\x20→\x20certificate','default_permissions':{'provider':0x3e8,'customer':'namedOperator','arbiter':0x5dc},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'user_decisions':['reuse\x20existing\x20or\x20create\x20new?'],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','course\x20details','token_type'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['enrollment\x20states','milestone\x20flow','completion'],'estimated_time':'15min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['enrollment\x20guard','completion\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['refund\x20guard'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service','Guard'],'user_decisions':['milestone\x20payments','refund\x20policy'],'estimated_time':'5min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Trust\x20Layer','object_types':['Guard']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'subscription','keywords':['subscription','subscribe','membership','recurring','monthly','newsletter','patreon','tier'],'description':'Recurring\x20subscription\x20with\x20renewal:\x20publish\x20→\x20subscribe\x20→\x20renew\x20→\x20cancel','default_permissions':{'provider':0x3e8,'customer':'namedOperator'},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','subscription\x20tiers','token_type'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['subscribe\x20states','renewal\x20flow','cancellation'],'estimated_time':'10min'},{'type':'Allocation','reversible':!![],'dependencies':['Service'],'user_decisions':['revenue\x20split'],'estimated_time':'3min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]},{'name':'general','keywords':[],'description':'Fallback\x20for\x20unmatched\x20scenarios\x20—\x20generic\x20service\x20template','default_permissions':{'provider':0x3e8,'customer':'namedOperator'},'objects':[{'type':'Permission','reversible':!![],'dependencies':[],'estimated_time':'2min'},{'type':'Service','reversible':!![],'dependencies':['Permission'],'user_decisions':['name','description','token_type'],'estimated_time':'3min'},{'type':'Machine','reversible':!![],'dependencies':['Service'],'user_decisions':['state\x20graph'],'estimated_time':'10min'},{'type':'Guard','reversible':![],'dependencies':['Machine'],'user_decisions':['guard\x20requirements'],'risk_flags':['immutable_after_creation'],'estimated_time':'5min'},{'type':'Allocation','reversible':!![],'dependencies':['Service'],'user_decisions':['sharing'],'estimated_time':'5min'}],'phases':[{'name':'Foundation','object_types':['Permission','Service']},{'name':'Business\x20Logic','object_types':['Machine']},{'name':'Trust\x20Layer','object_types':['Guard']},{'name':'Revenue','object_types':['Allocation']},{'name':'Publish','object_types':['Service']}]}];export function classifyIntent(a){const b=a['toLowerCase']();let c=null,d=0x0,e=[];for(const f of SCENARIO_REGISTRY){if(f['keywords']['length']===0x0)continue;const g=f['keywords']['filter'](h=>b['includes'](h));g['length']>d&&(d=g['length'],c=f,e=g);}if(c&&d>0x0){const h=Math['min'](d/0x3,0x1);return{'scenario':c['name'],'matched_keywords':e,'confidence':h,'fallback':![]};}return{'scenario':'general','matched_keywords':[],'confidence':0.3,'fallback':!![]};}let nodeIdCounter=0x0;function nextNodeId(a){return nodeIdCounter++,a['toLowerCase']()+'_'+nodeIdCounter;}export function generateODG(a,b){const c=classifyIntent(a),d=SCENARIO_REGISTRY['find'](h=>h['name']===c['scenario'])??SCENARIO_REGISTRY[SCENARIO_REGISTRY['length']-0x1],e=d['objects']['map'](h=>({'id':nextNodeId(h['type']),'type':h['type'],'status':'not_created','reversible':h['reversible'],'dependencies':[],'user_decisions':h['user_decisions'],'risk_flags':h['risk_flags'],'estimated_time':h['estimated_time']})),f=new Map();for(const h of e){const i=d['objects']['find'](j=>j['type']===h['type'])?.['dependencies']??[];h['dependencies']=i['map'](j=>f['get'](j))['filter'](j=>j!==undefined),f['set'](h['type'],h['id']);}const g=d['phases']['map'](j=>{const k=e['filter'](l=>j['object_types']['includes'](l['type']))['map'](l=>l['id']);return{'name':j['name'],'objects':k};});return{'task_id':b??'task_'+Date['now'](),'scenario':c['scenario'],'objects':e,'phases':g};}const PROJECT_TO_ODG_TYPE={'service':'Service','machine':'Machine','guard':'Guard','permission':'Permission','reward':'Reward','arb':'Arbitration','progress':'Progress','treasury':'Treasury','demand':'Demand','repository':'Repository','contact':'Contact','order':'Order','allocation':'Allocation','personal':'Personal','payment':'Payment'};function toODGObjectType(a){const b=PROJECT_TO_ODG_TYPE[a];if(b)return b;return a['charAt'](0x0)['toUpperCase']()+a['slice'](0x1);}export function generateODGFromSemanticGraph(a,b){const c=a['nodes']['map'](l=>({'id':l['id'],'type':toODGObjectType(l['type']),'status':l['expectedState']?.['published']?'published':'not_created','reversible':l['type']!=='guard','dependencies':[],'address':l['address']})),d=new Map(c['map'](l=>[l['id'],l]));for(const l of a['edges']){const m=d['get'](l['from']);m&&d['has'](l['to'])&&!m['dependencies']['includes'](l['to'])&&m['dependencies']['push'](l['to']);}const e=new Set(c['map'](n=>n['id'])),f=new Map();for(const n of c){f['set'](n['id'],n['dependencies']['filter'](p=>e['has'](p))['length']);}const g=[];let h=c['filter'](p=>(f['get'](p['id'])??0x0)===0x0)['map'](p=>p['id']);const i=new Set();while(h['length']>0x0){for(const q of h)i['add'](q);g['push']({'name':'Phase\x20'+(g['length']+0x1),'objects':[...h]});const p=[];for(const r of c){if(i['has'](r['id'])||p['includes'](r['id']))continue;const s=r['dependencies']['filter'](t=>e['has'](t)&&!i['has'](t))['length'];if(s===0x0)p['push'](r['id']);}h=p;}const j=c['filter'](t=>!i['has'](t['id']))['map'](t=>t['id']);j['length']>0x0&&g['push']({'name':'Phase\x20'+(g['length']+0x1),'objects':j});const k=classifyIntent(a['businessIntent']?.['description']??'');return{'task_id':b??'task_'+Date['now'](),'scenario':k['scenario'],'objects':c,'phases':g};}export function identifyDecisionPoints(a){const b=[],c=SCENARIO_REGISTRY['find'](e=>e['name']===a['scenario']);b['push']({'round':'R1','question':'I\x27ve\x20classified\x20your\x20intent\x20as\x20\x22'+a['scenario']+'\x22.\x20Is\x20this\x20correct?','options':['Yes,\x20correct','No,\x20let\x20me\x20clarify']}),b['push']({'round':'R2','question':'Do\x20you\x20have\x20existing\x20Permission\x20objects\x20to\x20reuse,\x20or\x20should\x20I\x20create\x20a\x20new\x20one?','options':['Create\x20new','Reuse\x20existing','Show\x20me\x20what\x20I\x20have']}),b['push']({'round':'R3','question':'What\x20is\x20the\x20service\x20name,\x20description,\x20and\x20pricing\x20token?','options':['WOW\x20(default)','USDT','USDC','Custom\x20token'],'default':'WOW\x20(default)'});c?.['default_permissions']['arbiter']&&b['push']({'round':'R4','question':'Permission\x20model:\x20provider=1000,\x20customer\x20uses\x20namedOperator,\x20arbiter=1500.\x20Adjust?','options':['Use\x20defaults','Customize'],'default':'Use\x20defaults'});b['push']({'round':'R5','question':'What\x20are\x20the\x20service\x20states\x20and\x20transitions?\x20(entry\x20→\x20states\x20→\x20terminals)','options':['Use\x20scenario\x20template','Custom\x20design']});const d=a['objects']['filter'](e=>e['type']==='Guard');return d['length']>0x0&&b['push']({'round':'R6','question':d['length']+'\x20Guard(s)\x20needed.\x20What\x20should\x20each\x20Guard\x20verify?','options':['Withdrawal\x20guard','Refund\x20guard','Delivery\x20guard','Custom']}),b['push']({'round':'R7','question':'How\x20should\x20revenue\x20be\x20split?\x20(e.g.,\x20merchant\x2080%,\x20platform\x2020%)','options':['100%\x20to\x20merchant','80/20\x20split','Custom\x20split'],'default':'100%\x20to\x20merchant'}),b;}export function detectCycles(a){const b=new Set(),c=new Set(),d=[];function e(f,g){if(c['has'](f)){const i=g['indexOf'](f);return d['push'](...g['slice'](i),f),!![];}if(b['has'](f))return![];b['add'](f),c['add'](f);const h=a['objects']['find'](j=>j['id']===f);if(h)for(const j of h['dependencies']){if(e(j,[...g,f]))return!![];}return c['delete'](f),![];}for(const f of a['objects']){if(!b['has'](f['id'])){if(e(f['id'],[]))return d;}}return null;}export function identifyMigrationDecisions(a){const b=a?.['current_payment_token']??'WOW',c=a?.['from_network']??'testnet',d=a?.['to_network']??'mainnet';return[{'round':'M1','question':'Your\x20project\x20currently\x20uses\x20\x22'+b+'\x22\x20as\x20the\x20payment\x20token\x20on\x20'+c+'.\x20'+('When\x20migrating\x20to\x20'+d+',\x20do\x20you\x20want\x20to\x20keep\x20\x22'+b+'\x22\x20or\x20switch\x20to\x20a\x20stablecoin\x20')+'(e.g.\x20USDT,\x20available\x20via\x20the\x20ETH\x20mainnet\x20cross-chain\x20bridge)?','options':['Keep\x20'+b,'Switch\x20to\x20USDT','Switch\x20to\x20USDC','Other\x20stablecoin'],'default':'Keep\x20'+b,'note':'Testnet\x20recommendation:\x20WOW\x20for\x20all\x20merchant\x20and\x20order\x20testing.\x20'+'Mainnet:\x20USDT\x20and\x20other\x20stablecoins\x20are\x20available\x20via\x20the\x20ETH\x20mainnet\x20cross-chain\x20bridge\x20'+'and\x20are\x20often\x20preferred\x20to\x20avoid\x20price\x20volatility.\x20If\x20switching,\x20the\x20Service\x20/\x20Treasury\x20/\x20'+'Allocation\x20type_parameter\x20must\x20be\x20updated\x20to\x20the\x20stablecoin\x27s\x20WOW\x20type\x20tag\x20before\x20publishing\x20on\x20mainnet.'}];}
|
|
@@ -10,7 +10,7 @@ export interface RecoveryRule {
|
|
|
10
10
|
}
|
|
11
11
|
export declare const RECOVERY_RULES: Record<string, RecoveryRule>;
|
|
12
12
|
export declare function resetAttempts(operationId: string): void;
|
|
13
|
-
export declare function recover(errorCode: string, operationId: string,
|
|
13
|
+
export declare function recover(errorCode: string, operationId: string, _context?: {
|
|
14
14
|
operation_type?: string;
|
|
15
15
|
data?: Record<string, unknown>;
|
|
16
16
|
}): RecoveryAction;
|
package/dist/harness/recover.js
CHANGED
|
@@ -1,139 +1 @@
|
|
|
1
|
-
export const RECOVERY_RULES = {
|
|
2
|
-
insufficient_balance: {
|
|
3
|
-
error_code: "insufficient_balance",
|
|
4
|
-
strategy: "claim_faucet",
|
|
5
|
-
max_attempts: 3,
|
|
6
|
-
automation: "semi",
|
|
7
|
-
detail: "1. Testnet: claim WOW from the faucet 2. Mainnet: transfer ETH/USDT/USDC/WBTC via the ETH mainnet cross-chain bridge (query active EVM account → top up from external wallet → confirm → cross-chain) 3. Mention the WOW airdrop (under construction) 4. Retry original operation",
|
|
8
|
-
user_prompt: "Insufficient balance for gas or operation. How to obtain WOW tokens: (1) Testnet — claim WOW from the faucet (https://faucet.testnet.wowok.net); all merchant and order testing can use WOW as the payment token. (2) Mainnet — transfer ETH / USDT / USDC / WBTC via the ETH mainnet cross-chain bridge: first query the active EVM account (bridge_operation query_active_evm_account, auto-generated on first use), then transfer from an external wallet (e.g. MetaMask) to that address, confirm the balance arrived, and cross-chain to WOW mainnet (bridge_operation cross_chain_evm_to_wow). (3) WOW mainnet airdrop: https://airdrop.wowok.net (under construction).",
|
|
9
|
-
},
|
|
10
|
-
network_error: {
|
|
11
|
-
error_code: "network_error",
|
|
12
|
-
strategy: "retry",
|
|
13
|
-
max_attempts: 5,
|
|
14
|
-
automation: "full",
|
|
15
|
-
detail: "Exponential backoff retry: 1s / 2s / 4s / 8s / 16s. Switch RPC node if available.",
|
|
16
|
-
},
|
|
17
|
-
guard_rejected: {
|
|
18
|
-
error_code: "guard_rejected",
|
|
19
|
-
strategy: "fill_submission",
|
|
20
|
-
max_attempts: 2,
|
|
21
|
-
automation: "semi",
|
|
22
|
-
detail: "1. Parse Guard table structure 2. Prompt user to fill submission fields 3. Resubmit with call_with_submission",
|
|
23
|
-
user_prompt: "Guard verification rejected. Please fill in the required submission data and resubmit.",
|
|
24
|
-
},
|
|
25
|
-
immutable_violation: {
|
|
26
|
-
error_code: "immutable_violation",
|
|
27
|
-
strategy: "recreate",
|
|
28
|
-
max_attempts: 1,
|
|
29
|
-
automation: "semi",
|
|
30
|
-
detail: "1. Stop modification attempt 2. Evaluate creating a new object as replacement 3. Re-plan affected phases",
|
|
31
|
-
user_prompt: "Cannot modify an immutable object. A new object must be created as a replacement. Confirm to proceed with recreation.",
|
|
32
|
-
},
|
|
33
|
-
permission_denied: {
|
|
34
|
-
error_code: "permission_denied",
|
|
35
|
-
strategy: "switch_account",
|
|
36
|
-
max_attempts: 2,
|
|
37
|
-
automation: "semi",
|
|
38
|
-
detail: "1. Query object's permission_guard 2. List accounts with permission 3. Switch account or prompt user to add permission",
|
|
39
|
-
user_prompt: "Current account lacks permission for this operation. Switch to an authorized account or update the Permission object.",
|
|
40
|
-
},
|
|
41
|
-
object_not_found: {
|
|
42
|
-
error_code: "object_not_found",
|
|
43
|
-
strategy: "query_and_retry",
|
|
44
|
-
max_attempts: 3,
|
|
45
|
-
automation: "semi",
|
|
46
|
-
detail: "1. Re-query the object (may be sync delay) 2. If truly absent, search for similar objects 3. Prompt user to reselect",
|
|
47
|
-
user_prompt: "Referenced object not found. It may be a synchronization delay. Retrying... If the issue persists, please select a valid object.",
|
|
48
|
-
},
|
|
49
|
-
state_conflict: {
|
|
50
|
-
error_code: "state_conflict",
|
|
51
|
-
strategy: "adjust_params",
|
|
52
|
-
max_attempts: 2,
|
|
53
|
-
automation: "full",
|
|
54
|
-
detail: "1. Query object's current true state 2. Update ODG status annotations 3. Adjust subsequent operations (e.g., skip completed steps)",
|
|
55
|
-
},
|
|
56
|
-
invalid_parameter: {
|
|
57
|
-
error_code: "invalid_parameter",
|
|
58
|
-
strategy: "adjust_params",
|
|
59
|
-
max_attempts: 2,
|
|
60
|
-
automation: "semi",
|
|
61
|
-
detail: "1. Query the relevant schema 2. Auto-fix obvious errors (e.g., BigInt vs string) 3. If unfixable, prompt user",
|
|
62
|
-
user_prompt: "Parameter validation failed. Please check the parameter types and values against the schema and retry.",
|
|
63
|
-
},
|
|
64
|
-
unknown: {
|
|
65
|
-
error_code: "unknown",
|
|
66
|
-
strategy: "escalate_human",
|
|
67
|
-
max_attempts: 1,
|
|
68
|
-
automation: "manual",
|
|
69
|
-
detail: "1. Report full error context to telemetry 2. Escalate to human intervention 3. Flag for Loop Engineering rule addition",
|
|
70
|
-
user_prompt: "An unclassified error occurred. Please review the error details and contact support if needed. This error has been logged for tool improvement.",
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
const operationAttempts = new Map();
|
|
74
|
-
function getAttemptCount(operationId, errorCode) {
|
|
75
|
-
const opMap = operationAttempts.get(operationId);
|
|
76
|
-
if (!opMap)
|
|
77
|
-
return 0;
|
|
78
|
-
return opMap.get(errorCode) ?? 0;
|
|
79
|
-
}
|
|
80
|
-
function incrementAttempt(operationId, errorCode) {
|
|
81
|
-
if (!operationAttempts.has(operationId)) {
|
|
82
|
-
operationAttempts.set(operationId, new Map());
|
|
83
|
-
}
|
|
84
|
-
const opMap = operationAttempts.get(operationId);
|
|
85
|
-
const current = (opMap.get(errorCode) ?? 0) + 1;
|
|
86
|
-
opMap.set(errorCode, current);
|
|
87
|
-
return current;
|
|
88
|
-
}
|
|
89
|
-
function getTotalAttempts(operationId) {
|
|
90
|
-
const opMap = operationAttempts.get(operationId);
|
|
91
|
-
if (!opMap)
|
|
92
|
-
return 0;
|
|
93
|
-
let total = 0;
|
|
94
|
-
for (const count of opMap.values())
|
|
95
|
-
total += count;
|
|
96
|
-
return total;
|
|
97
|
-
}
|
|
98
|
-
export function resetAttempts(operationId) {
|
|
99
|
-
operationAttempts.delete(operationId);
|
|
100
|
-
}
|
|
101
|
-
export function recover(errorCode, operationId, context) {
|
|
102
|
-
const rule = RECOVERY_RULES[errorCode] ?? RECOVERY_RULES.unknown;
|
|
103
|
-
const TOTAL_RETRY_LIMIT = 5;
|
|
104
|
-
const totalAttempts = getTotalAttempts(operationId);
|
|
105
|
-
const typeAttempts = getAttemptCount(operationId, errorCode);
|
|
106
|
-
if (totalAttempts >= TOTAL_RETRY_LIMIT) {
|
|
107
|
-
return {
|
|
108
|
-
strategy: "stop",
|
|
109
|
-
should_retry: false,
|
|
110
|
-
max_attempts: TOTAL_RETRY_LIMIT,
|
|
111
|
-
current_attempt: totalAttempts,
|
|
112
|
-
detail: `Total retry limit (${TOTAL_RETRY_LIMIT}) reached for operation ${operationId}. Escalating to human intervention.`,
|
|
113
|
-
user_prompt: "Maximum retry attempts reached. Manual intervention required.",
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
if (typeAttempts >= rule.max_attempts) {
|
|
117
|
-
return {
|
|
118
|
-
strategy: "escalate_human",
|
|
119
|
-
should_retry: false,
|
|
120
|
-
max_attempts: rule.max_attempts,
|
|
121
|
-
current_attempt: typeAttempts,
|
|
122
|
-
detail: `Per-error-code retry limit (${rule.max_attempts}) reached for ${errorCode}. Escalating to human.`,
|
|
123
|
-
user_prompt: `Recovery attempts for ${errorCode} exhausted. Manual intervention required.`,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
const currentAttempt = incrementAttempt(operationId, errorCode);
|
|
127
|
-
return {
|
|
128
|
-
strategy: rule.strategy,
|
|
129
|
-
should_retry: rule.automation === "full" || currentAttempt < rule.max_attempts,
|
|
130
|
-
max_attempts: rule.max_attempts,
|
|
131
|
-
current_attempt: currentAttempt,
|
|
132
|
-
adjusted_params: rule.adjusted_params,
|
|
133
|
-
user_prompt: rule.user_prompt,
|
|
134
|
-
detail: rule.detail,
|
|
135
|
-
};
|
|
136
|
-
}
|
|
137
|
-
export function getBackoffDelay(attempt) {
|
|
138
|
-
return Math.pow(2, attempt - 1) * 1000;
|
|
139
|
-
}
|
|
1
|
+
export const RECOVERY_RULES={'insufficient_balance':{'error_code':'insufficient_balance','strategy':'claim_faucet','max_attempts':0x3,'automation':'semi','detail':'1.\x20Testnet:\x20claim\x20WOW\x20from\x20the\x20faucet\x202.\x20Mainnet:\x20transfer\x20ETH/USDT/USDC/WBTC\x20via\x20the\x20ETH\x20mainnet\x20cross-chain\x20bridge\x20(query\x20active\x20EVM\x20account\x20→\x20top\x20up\x20from\x20external\x20wallet\x20→\x20confirm\x20→\x20cross-chain)\x203.\x20Mention\x20the\x20WOW\x20airdrop\x20(under\x20construction)\x204.\x20Retry\x20original\x20operation','user_prompt':'Insufficient\x20balance\x20for\x20gas\x20or\x20operation.\x20How\x20to\x20obtain\x20WOW\x20tokens:\x20(1)\x20Testnet\x20—\x20claim\x20WOW\x20from\x20the\x20faucet\x20(https://faucet.testnet.wowok.net);\x20all\x20merchant\x20and\x20order\x20testing\x20can\x20use\x20WOW\x20as\x20the\x20payment\x20token.\x20(2)\x20Mainnet\x20—\x20transfer\x20ETH\x20/\x20USDT\x20/\x20USDC\x20/\x20WBTC\x20via\x20the\x20ETH\x20mainnet\x20cross-chain\x20bridge:\x20first\x20query\x20the\x20active\x20EVM\x20account\x20(bridge_operation\x20query_active_evm_account,\x20auto-generated\x20on\x20first\x20use),\x20then\x20transfer\x20from\x20an\x20external\x20wallet\x20(e.g.\x20MetaMask)\x20to\x20that\x20address,\x20confirm\x20the\x20balance\x20arrived,\x20and\x20cross-chain\x20to\x20WOW\x20mainnet\x20(bridge_operation\x20cross_chain_evm_to_wow).\x20(3)\x20WOW\x20mainnet\x20airdrop:\x20https://airdrop.wowok.net\x20(under\x20construction).'},'network_error':{'error_code':'network_error','strategy':'retry','max_attempts':0x5,'automation':'full','detail':'Exponential\x20backoff\x20retry:\x201s\x20/\x202s\x20/\x204s\x20/\x208s\x20/\x2016s.\x20Switch\x20RPC\x20node\x20if\x20available.'},'guard_rejected':{'error_code':'guard_rejected','strategy':'fill_submission','max_attempts':0x2,'automation':'semi','detail':'1.\x20Parse\x20Guard\x20table\x20structure\x202.\x20Prompt\x20user\x20to\x20fill\x20submission\x20fields\x203.\x20Resubmit\x20with\x20call_with_submission','user_prompt':'Guard\x20verification\x20rejected.\x20Please\x20fill\x20in\x20the\x20required\x20submission\x20data\x20and\x20resubmit.'},'immutable_violation':{'error_code':'immutable_violation','strategy':'recreate','max_attempts':0x1,'automation':'semi','detail':'1.\x20Stop\x20modification\x20attempt\x202.\x20Evaluate\x20creating\x20a\x20new\x20object\x20as\x20replacement\x203.\x20Re-plan\x20affected\x20phases','user_prompt':'Cannot\x20modify\x20an\x20immutable\x20object.\x20A\x20new\x20object\x20must\x20be\x20created\x20as\x20a\x20replacement.\x20Confirm\x20to\x20proceed\x20with\x20recreation.'},'permission_denied':{'error_code':'permission_denied','strategy':'switch_account','max_attempts':0x2,'automation':'semi','detail':'1.\x20Query\x20object\x27s\x20permission_guard\x202.\x20List\x20accounts\x20with\x20permission\x203.\x20Switch\x20account\x20or\x20prompt\x20user\x20to\x20add\x20permission','user_prompt':'Current\x20account\x20lacks\x20permission\x20for\x20this\x20operation.\x20Switch\x20to\x20an\x20authorized\x20account\x20or\x20update\x20the\x20Permission\x20object.'},'object_not_found':{'error_code':'object_not_found','strategy':'query_and_retry','max_attempts':0x3,'automation':'semi','detail':'1.\x20Re-query\x20the\x20object\x20(may\x20be\x20sync\x20delay)\x202.\x20If\x20truly\x20absent,\x20search\x20for\x20similar\x20objects\x203.\x20Prompt\x20user\x20to\x20reselect','user_prompt':'Referenced\x20object\x20not\x20found.\x20It\x20may\x20be\x20a\x20synchronization\x20delay.\x20Retrying...\x20If\x20the\x20issue\x20persists,\x20please\x20select\x20a\x20valid\x20object.'},'state_conflict':{'error_code':'state_conflict','strategy':'adjust_params','max_attempts':0x2,'automation':'full','detail':'1.\x20Query\x20object\x27s\x20current\x20true\x20state\x202.\x20Update\x20ODG\x20status\x20annotations\x203.\x20Adjust\x20subsequent\x20operations\x20(e.g.,\x20skip\x20completed\x20steps)'},'invalid_parameter':{'error_code':'invalid_parameter','strategy':'adjust_params','max_attempts':0x2,'automation':'semi','detail':'1.\x20Query\x20the\x20relevant\x20schema\x202.\x20Auto-fix\x20obvious\x20errors\x20(e.g.,\x20BigInt\x20vs\x20string)\x203.\x20If\x20unfixable,\x20prompt\x20user','user_prompt':'Parameter\x20validation\x20failed.\x20Please\x20check\x20the\x20parameter\x20types\x20and\x20values\x20against\x20the\x20schema\x20and\x20retry.'},'unknown':{'error_code':'unknown','strategy':'escalate_human','max_attempts':0x1,'automation':'manual','detail':'1.\x20Report\x20full\x20error\x20context\x20to\x20telemetry\x202.\x20Escalate\x20to\x20human\x20intervention\x203.\x20Flag\x20for\x20Loop\x20Engineering\x20rule\x20addition','user_prompt':'An\x20unclassified\x20error\x20occurred.\x20Please\x20review\x20the\x20error\x20details\x20and\x20contact\x20support\x20if\x20needed.\x20This\x20error\x20has\x20been\x20logged\x20for\x20tool\x20improvement.'}};const operationAttempts=new Map();function getAttemptCount(a,b){const c=operationAttempts['get'](a);if(!c)return 0x0;return c['get'](b)??0x0;}function incrementAttempt(a,b){!operationAttempts['has'](a)&&operationAttempts['set'](a,new Map());const c=operationAttempts['get'](a),d=(c['get'](b)??0x0)+0x1;return c['set'](b,d),d;}function getTotalAttempts(a){const b=operationAttempts['get'](a);if(!b)return 0x0;let c=0x0;for(const d of b['values']())c+=d;return c;}export function resetAttempts(a){operationAttempts['delete'](a);}export function recover(a,b,c){const d=RECOVERY_RULES[a]??RECOVERY_RULES['unknown'],e=0x5,f=getTotalAttempts(b),g=getAttemptCount(b,a);if(f>=e)return{'strategy':'stop','should_retry':![],'max_attempts':e,'current_attempt':f,'detail':'Total\x20retry\x20limit\x20('+e+')\x20reached\x20for\x20operation\x20'+b+'.\x20Escalating\x20to\x20human\x20intervention.','user_prompt':'Maximum\x20retry\x20attempts\x20reached.\x20Manual\x20intervention\x20required.'};if(g>=d['max_attempts'])return{'strategy':'escalate_human','should_retry':![],'max_attempts':d['max_attempts'],'current_attempt':g,'detail':'Per-error-code\x20retry\x20limit\x20('+d['max_attempts']+')\x20reached\x20for\x20'+a+'.\x20Escalating\x20to\x20human.','user_prompt':'Recovery\x20attempts\x20for\x20'+a+'\x20exhausted.\x20Manual\x20intervention\x20required.'};const h=incrementAttempt(b,a);return{'strategy':d['strategy'],'should_retry':d['automation']==='full'||h<d['max_attempts'],'max_attempts':d['max_attempts'],'current_attempt':h,'adjusted_params':d['adjusted_params'],'user_prompt':d['user_prompt'],'detail':d['detail']};}export function getBackoffDelay(a){return Math['pow'](0x2,a-0x1)*0x3e8;}
|
package/dist/harness/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import type { GraphNodeBase } from "../graph/base.js";
|
|
1
2
|
export type ObjectType = "Permission" | "Service" | "Machine" | "Guard" | "Allocation" | "Progress" | "Repository" | "Treasury" | "Reward" | "Demand" | "Order" | "Arbitration" | "Contact" | "Personal" | "Payment";
|
|
2
3
|
export type ObjectStatus = "not_created" | "created_unpublished" | "published" | "failed";
|
|
3
|
-
export interface ODGNode {
|
|
4
|
-
id: string;
|
|
4
|
+
export interface ODGNode extends GraphNodeBase {
|
|
5
5
|
type: ObjectType;
|
|
6
6
|
status: ObjectStatus;
|
|
7
7
|
reversible: boolean;
|
|
@@ -9,7 +9,6 @@ export interface ODGNode {
|
|
|
9
9
|
user_decisions?: string[];
|
|
10
10
|
risk_flags?: string[];
|
|
11
11
|
estimated_time?: string;
|
|
12
|
-
address?: string;
|
|
13
12
|
}
|
|
14
13
|
export interface ODGPhase {
|
|
15
14
|
name: string;
|
package/dist/harness/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export{};
|