@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,198 +1 @@
|
|
|
1
|
-
const BUILTIN_CONSTRAINTS = [
|
|
2
|
-
{
|
|
3
|
-
constraint_id: "require_arbitration",
|
|
4
|
-
display_name: "Require Arbitration",
|
|
5
|
-
description: "Mode must include arbitration capability (arb.*) for dispute resolution",
|
|
6
|
-
rule: { type: "capability_required", capability_id: "arb.vote_weighted" },
|
|
7
|
-
severity: "hard",
|
|
8
|
-
on_violation: "block",
|
|
9
|
-
scope: "builtin",
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
constraint_id: "require_compensation_fund",
|
|
13
|
-
display_name: "Require Compensation Fund",
|
|
14
|
-
description: "Mode must include fund escrow capability (treasury.*) for compensation fund",
|
|
15
|
-
rule: { type: "capability_required", capability_id: "treasury.owner_receive" },
|
|
16
|
-
severity: "hard",
|
|
17
|
-
on_violation: "block",
|
|
18
|
-
scope: "builtin",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
constraint_id: "require_wip_evidence",
|
|
22
|
-
display_name: "Require WIP Evidence",
|
|
23
|
-
description: "Mode must include WIP evidence capability (guard.validate_wip_hash) for digital delivery validation",
|
|
24
|
-
rule: { type: "capability_required", capability_id: "guard.validate_wip_hash" },
|
|
25
|
-
severity: "soft",
|
|
26
|
-
on_violation: "warn",
|
|
27
|
-
scope: "builtin",
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
constraint_id: "max_single_transaction_limit",
|
|
31
|
-
display_name: "Single Transaction Limit",
|
|
32
|
-
description: "Single transaction amount must not exceed 10000 WOW (default value, can be overridden by mode)",
|
|
33
|
-
rule: { type: "numeric_limit", field: "max_single_transaction", max: 10000 },
|
|
34
|
-
severity: "soft",
|
|
35
|
-
on_violation: "warn",
|
|
36
|
-
scope: "builtin",
|
|
37
|
-
},
|
|
38
|
-
];
|
|
39
|
-
export class ConstraintRegistry {
|
|
40
|
-
static instance;
|
|
41
|
-
constraints = new Map();
|
|
42
|
-
initialized = false;
|
|
43
|
-
static Instance() {
|
|
44
|
-
if (!ConstraintRegistry.instance) {
|
|
45
|
-
ConstraintRegistry.instance = new ConstraintRegistry();
|
|
46
|
-
}
|
|
47
|
-
return ConstraintRegistry.instance;
|
|
48
|
-
}
|
|
49
|
-
constructor() {
|
|
50
|
-
this.registerBuiltinConstraints();
|
|
51
|
-
this.initialized = true;
|
|
52
|
-
}
|
|
53
|
-
registerConstraint(constraint) {
|
|
54
|
-
if (!constraint.constraint_id || !constraint.rule)
|
|
55
|
-
return false;
|
|
56
|
-
if (this.constraints.has(constraint.constraint_id))
|
|
57
|
-
return false;
|
|
58
|
-
this.constraints.set(constraint.constraint_id, constraint);
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
registerCustomConstraint(constraint_id, display_name, description, rule, owner, severity = "soft", on_violation = "warn") {
|
|
62
|
-
return this.registerConstraint({
|
|
63
|
-
constraint_id,
|
|
64
|
-
display_name,
|
|
65
|
-
description,
|
|
66
|
-
rule,
|
|
67
|
-
severity,
|
|
68
|
-
on_violation,
|
|
69
|
-
scope: "custom",
|
|
70
|
-
owner,
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
getConstraint(constraint_id) {
|
|
74
|
-
return this.constraints.get(constraint_id);
|
|
75
|
-
}
|
|
76
|
-
listConstraints(filter) {
|
|
77
|
-
let all = Array.from(this.constraints.values());
|
|
78
|
-
if (!filter)
|
|
79
|
-
return all;
|
|
80
|
-
if (filter.scope)
|
|
81
|
-
all = all.filter(c => c.scope === filter.scope);
|
|
82
|
-
if (filter.owner)
|
|
83
|
-
all = all.filter(c => c.owner === filter.owner);
|
|
84
|
-
if (filter.severity)
|
|
85
|
-
all = all.filter(c => c.severity === filter.severity);
|
|
86
|
-
return all;
|
|
87
|
-
}
|
|
88
|
-
unregisterConstraint(constraint_id, owner) {
|
|
89
|
-
const constraint = this.constraints.get(constraint_id);
|
|
90
|
-
if (!constraint || constraint.scope !== "custom" || constraint.owner !== owner)
|
|
91
|
-
return false;
|
|
92
|
-
return this.constraints.delete(constraint_id);
|
|
93
|
-
}
|
|
94
|
-
checkConstraints(mode, _capabilityRegistry, extraConstraints) {
|
|
95
|
-
const disabled = new Set(mode.disabled_builtin_constraints ?? []);
|
|
96
|
-
const allConstraints = [...this.constraints.values()]
|
|
97
|
-
.filter(c => !(c.scope === "builtin" && disabled.has(c.constraint_id)));
|
|
98
|
-
if (extraConstraints) {
|
|
99
|
-
for (const c of extraConstraints) {
|
|
100
|
-
if (!allConstraints.some(existing => existing.constraint_id === c.constraint_id)) {
|
|
101
|
-
allConstraints.push(c);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
const violations = [];
|
|
106
|
-
for (const constraint of allConstraints) {
|
|
107
|
-
const violation = this.checkConstraint(mode, constraint);
|
|
108
|
-
if (violation) {
|
|
109
|
-
violations.push(violation);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return violations;
|
|
113
|
-
}
|
|
114
|
-
checkConstraint(mode, constraint) {
|
|
115
|
-
const rule = constraint.rule;
|
|
116
|
-
switch (rule.type) {
|
|
117
|
-
case "capability_required": {
|
|
118
|
-
if (!mode.capabilities_used.includes(rule.capability_id)) {
|
|
119
|
-
return {
|
|
120
|
-
constraint_id: constraint.constraint_id,
|
|
121
|
-
display_name: constraint.display_name,
|
|
122
|
-
violation: `Missing required capability: ${rule.capability_id}`,
|
|
123
|
-
severity: constraint.severity,
|
|
124
|
-
action: constraint.on_violation,
|
|
125
|
-
recommendation: `Add "${rule.capability_id}" to capabilities_used`,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
case "capability_forbidden": {
|
|
131
|
-
if (mode.capabilities_used.includes(rule.capability_id)) {
|
|
132
|
-
return {
|
|
133
|
-
constraint_id: constraint.constraint_id,
|
|
134
|
-
display_name: constraint.display_name,
|
|
135
|
-
violation: `Contains forbidden capability: ${rule.capability_id}`,
|
|
136
|
-
severity: constraint.severity,
|
|
137
|
-
action: constraint.on_violation,
|
|
138
|
-
recommendation: `Remove "${rule.capability_id}" from capabilities_used`,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
return null;
|
|
142
|
-
}
|
|
143
|
-
case "numeric_limit": {
|
|
144
|
-
const fieldValue = this.getNumericField(mode, rule.field);
|
|
145
|
-
if (fieldValue === undefined)
|
|
146
|
-
return null;
|
|
147
|
-
if (rule.max !== undefined && fieldValue > rule.max) {
|
|
148
|
-
return {
|
|
149
|
-
constraint_id: constraint.constraint_id,
|
|
150
|
-
display_name: constraint.display_name,
|
|
151
|
-
violation: `${rule.field}=${fieldValue} exceeds upper limit ${rule.max}`,
|
|
152
|
-
severity: constraint.severity,
|
|
153
|
-
action: constraint.on_violation,
|
|
154
|
-
recommendation: `Reduce ${rule.field} below ${rule.max}`,
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
if (rule.min !== undefined && fieldValue < rule.min) {
|
|
158
|
-
return {
|
|
159
|
-
constraint_id: constraint.constraint_id,
|
|
160
|
-
display_name: constraint.display_name,
|
|
161
|
-
violation: `${rule.field}=${fieldValue} below lower limit ${rule.min}`,
|
|
162
|
-
severity: constraint.severity,
|
|
163
|
-
action: constraint.on_violation,
|
|
164
|
-
recommendation: `Increase ${rule.field} above ${rule.min}`,
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
case "condition_required": {
|
|
170
|
-
return {
|
|
171
|
-
constraint_id: constraint.constraint_id,
|
|
172
|
-
display_name: constraint.display_name,
|
|
173
|
-
violation: `Natural language condition pending AI evaluation: "${rule.condition}"`,
|
|
174
|
-
severity: constraint.severity,
|
|
175
|
-
action: constraint.on_violation,
|
|
176
|
-
recommendation: `Please have AI evaluate whether this condition is satisfied, and update the mode configuration`,
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
default:
|
|
180
|
-
return null;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
getNumericField(mode, field) {
|
|
184
|
-
if (field === "max_single_transaction") {
|
|
185
|
-
return mode.risk_constraints.max_single_transaction;
|
|
186
|
-
}
|
|
187
|
-
return undefined;
|
|
188
|
-
}
|
|
189
|
-
registerBuiltinConstraints() {
|
|
190
|
-
for (const constraint of BUILTIN_CONSTRAINTS) {
|
|
191
|
-
this.registerConstraint(constraint);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
export function getConstraintRegistry() {
|
|
196
|
-
return ConstraintRegistry.Instance();
|
|
197
|
-
}
|
|
198
|
-
export const BUILTIN_CONSTRAINTS_COUNT = BUILTIN_CONSTRAINTS.length;
|
|
1
|
+
const BUILTIN_CONSTRAINTS=[{'constraint_id':'require_arbitration','display_name':'Require\x20Arbitration','description':'Mode\x20must\x20include\x20arbitration\x20capability\x20(arb.*)\x20for\x20dispute\x20resolution','rule':{'type':'capability_required','capability_id':'arb.vote_weighted'},'severity':'hard','on_violation':'block','scope':'builtin'},{'constraint_id':'require_compensation_fund','display_name':'Require\x20Compensation\x20Fund','description':'Mode\x20must\x20include\x20fund\x20escrow\x20capability\x20(treasury.*)\x20for\x20compensation\x20fund','rule':{'type':'capability_required','capability_id':'treasury.owner_receive'},'severity':'hard','on_violation':'block','scope':'builtin'},{'constraint_id':'require_wip_evidence','display_name':'Require\x20WIP\x20Evidence','description':'Mode\x20must\x20include\x20WIP\x20evidence\x20capability\x20(guard.validate_wip_hash)\x20for\x20digital\x20delivery\x20validation','rule':{'type':'capability_required','capability_id':'guard.validate_wip_hash'},'severity':'soft','on_violation':'warn','scope':'builtin'},{'constraint_id':'max_single_transaction_limit','display_name':'Single\x20Transaction\x20Limit','description':'Single\x20transaction\x20amount\x20must\x20not\x20exceed\x2010000\x20WOW\x20(default\x20value,\x20can\x20be\x20overridden\x20by\x20mode)','rule':{'type':'numeric_limit','field':'max_single_transaction','max':0x2710},'severity':'soft','on_violation':'warn','scope':'builtin'}];export class ConstraintRegistry{static ['instance'];['constraints']=new Map();['initialized']=![];static['Instance'](){return!ConstraintRegistry['instance']&&(ConstraintRegistry['instance']=new ConstraintRegistry()),ConstraintRegistry['instance'];}constructor(){this['registerBuiltinConstraints'](),this['initialized']=!![];}['registerConstraint'](a){if(!a['constraint_id']||!a['rule'])return![];if(this['constraints']['has'](a['constraint_id']))return![];return this['constraints']['set'](a['constraint_id'],a),!![];}['registerCustomConstraint'](a,b,c,d,e,f='soft',g='warn'){return this['registerConstraint']({'constraint_id':a,'display_name':b,'description':c,'rule':d,'severity':f,'on_violation':g,'scope':'custom','owner':e});}['getConstraint'](a){return this['constraints']['get'](a);}['listConstraints'](a){let b=Array['from'](this['constraints']['values']());if(!a)return b;if(a['scope'])b=b['filter'](d=>d['scope']===a['scope']);if(a['owner'])b=b['filter'](d=>d['owner']===a['owner']);if(a['severity'])b=b['filter'](d=>d['severity']===a['severity']);return b;}['unregisterConstraint'](a,b){const c=this['constraints']['get'](a);if(!c||c['scope']!=='custom'||c['owner']!==b)return![];return this['constraints']['delete'](a);}['checkConstraints'](a,b,d){const e=new Set(a['disabled_builtin_constraints']??[]),f=[...this['constraints']['values']()]['filter'](h=>!(h['scope']==='builtin'&&e['has'](h['constraint_id'])));if(d)for(const h of d){!f['some'](i=>i['constraint_id']===h['constraint_id'])&&f['push'](h);}const g=[];for(const i of f){const j=this['checkConstraint'](a,i);j&&g['push'](j);}return g;}['checkConstraint'](a,b){const c=b['rule'];switch(c['type']){case'capability_required':{if(!a['capabilities_used']['includes'](c['capability_id']))return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':'Missing\x20required\x20capability:\x20'+c['capability_id'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Add\x20\x22'+c['capability_id']+'\x22\x20to\x20capabilities_used'};return null;}case'capability_forbidden':{if(a['capabilities_used']['includes'](c['capability_id']))return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':'Contains\x20forbidden\x20capability:\x20'+c['capability_id'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Remove\x20\x22'+c['capability_id']+'\x22\x20from\x20capabilities_used'};return null;}case'numeric_limit':{const d=this['getNumericField'](a,c['field']);if(d===undefined)return null;if(c['max']!==undefined&&d>c['max'])return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':c['field']+'='+d+'\x20exceeds\x20upper\x20limit\x20'+c['max'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Reduce\x20'+c['field']+'\x20below\x20'+c['max']};if(c['min']!==undefined&&d<c['min'])return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':c['field']+'='+d+'\x20below\x20lower\x20limit\x20'+c['min'],'severity':b['severity'],'action':b['on_violation'],'recommendation':'Increase\x20'+c['field']+'\x20above\x20'+c['min']};return null;}case'condition_required':{return{'constraint_id':b['constraint_id'],'display_name':b['display_name'],'violation':'Natural\x20language\x20condition\x20pending\x20AI\x20evaluation:\x20\x22'+c['condition']+'\x22','severity':b['severity'],'action':b['on_violation'],'recommendation':'Please\x20have\x20AI\x20evaluate\x20whether\x20this\x20condition\x20is\x20satisfied,\x20and\x20update\x20the\x20mode\x20configuration'};}default:return null;}}['getNumericField'](a,b){if(b==='max_single_transaction')return a['risk_constraints']['max_single_transaction'];return undefined;}['registerBuiltinConstraints'](){for(const a of BUILTIN_CONSTRAINTS){this['registerConstraint'](a);}}}export function getConstraintRegistry(){return ConstraintRegistry['Instance']();}export const BUILTIN_CONSTRAINTS_COUNT=BUILTIN_CONSTRAINTS['length'];
|
|
@@ -10,3 +10,9 @@ export { MetricRegistry, getMetricRegistry, BUILTIN_METRICS_COUNT, } from "./met
|
|
|
10
10
|
export { ConstraintRegistry, getConstraintRegistry, BUILTIN_CONSTRAINTS_COUNT, } from "./constraint-registry.js";
|
|
11
11
|
export { ModeEvaluator } from "./mode-evaluator.js";
|
|
12
12
|
export { BUILTIN_MODES } from "./modes.js";
|
|
13
|
+
export { registerIndustryPack, validatePackManifest, listRegisteredPacks, unregisterIndustryPack, scanPacks, rescanPack, resolveIndustryPackDir, scanDefaultIndustryPacks, scaffoldIndustryPack, seedBuiltinIndustryTemplates, diffIndustryPack, resetIndustryPath, readMergedPackIfPresent, buildPristineMergedPack, locatePackAndRemainder, ensureIndustryReadme, industryReadmeContent, } from "./industry-pack.js";
|
|
14
|
+
export type { IndustryPackManifest, IndustryPack, IndustryPackLayout, MergedIndustryPack, PackValidation, PackRegistrationResult, PackRecord, ScaffoldResult, PackDiffResult, ResetResult, } from "./industry-pack.js";
|
|
15
|
+
export { registerDisputeRules, registerComplianceRules, registerSupplyRules, registerIndustryRules, registerIndustryPlaybook, resolveDisputeRules, resolveComplianceRules, resolveSupplyRules, resolveIndustryRules, resolveIndustryPlaybook, listRegisteredDisputeCategories, listRegisteredComplianceCategories, listRegisteredSupplyCategories, listRegisteredIndustryRuleCategories, listRegisteredPlaybookCategories, compileIndustryRule, compileIndustryRules, registerIndustryRulesToEngine, unregisterIndustryRulesFromEngine, } from "./industry-layers.js";
|
|
16
|
+
export type { DisputeSlaTier, IndustryDisputeRules, ComplianceRules, SupplyRules, IndustryRule, IndustryRuleCondition, IndustryRuleOperator, IndustryRules, IndustryPlaybook, } from "./industry-layers.js";
|
|
17
|
+
export { registerIndustryPersonae, getIndustryPersona, listPersonaeIndustries, unregisterIndustryPersonae, } from "../persona/pack-personae.js";
|
|
18
|
+
export type { IndustryPersona } from "../persona/pack-personae.js";
|
package/dist/extensions/index.js
CHANGED
|
@@ -1,6 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { IndustryModeRegistry, getIndustryModeRegistry, INDUSTRY_MODE_REGISTRY_VERSION, } from "./registry.js";
|
|
3
|
-
export { MetricRegistry, getMetricRegistry, BUILTIN_METRICS_COUNT, } from "./metric-registry.js";
|
|
4
|
-
export { ConstraintRegistry, getConstraintRegistry, BUILTIN_CONSTRAINTS_COUNT, } from "./constraint-registry.js";
|
|
5
|
-
export { ModeEvaluator } from "./mode-evaluator.js";
|
|
6
|
-
export { BUILTIN_MODES } from "./modes.js";
|
|
1
|
+
export{CapabilityRegistry,getCapabilityRegistry,recordCapabilitiesUsed,CAPABILITY_MANIFEST_VERSION}from'./capability-manifest.js';export{IndustryModeRegistry,getIndustryModeRegistry,INDUSTRY_MODE_REGISTRY_VERSION}from'./registry.js';export{MetricRegistry,getMetricRegistry,BUILTIN_METRICS_COUNT}from'./metric-registry.js';export{ConstraintRegistry,getConstraintRegistry,BUILTIN_CONSTRAINTS_COUNT}from'./constraint-registry.js';export{ModeEvaluator}from'./mode-evaluator.js';export{BUILTIN_MODES}from'./modes.js';export{registerIndustryPack,validatePackManifest,listRegisteredPacks,unregisterIndustryPack,scanPacks,rescanPack,resolveIndustryPackDir,scanDefaultIndustryPacks,scaffoldIndustryPack,seedBuiltinIndustryTemplates,diffIndustryPack,resetIndustryPath,readMergedPackIfPresent,buildPristineMergedPack,locatePackAndRemainder,ensureIndustryReadme,industryReadmeContent}from'./industry-pack.js';export{registerDisputeRules,registerComplianceRules,registerSupplyRules,registerIndustryRules,registerIndustryPlaybook,resolveDisputeRules,resolveComplianceRules,resolveSupplyRules,resolveIndustryRules,resolveIndustryPlaybook,listRegisteredDisputeCategories,listRegisteredComplianceCategories,listRegisteredSupplyCategories,listRegisteredIndustryRuleCategories,listRegisteredPlaybookCategories,compileIndustryRule,compileIndustryRules,registerIndustryRulesToEngine,unregisterIndustryRulesFromEngine}from'./industry-layers.js';export{registerIndustryPersonae,getIndustryPersona,listPersonaeIndustries,unregisterIndustryPersonae}from'../persona/pack-personae.js';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { EvaluationRule } from "../evaluation/types.js";
|
|
2
|
+
export interface DisputeSlaTier {
|
|
3
|
+
level: string;
|
|
4
|
+
timeout?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface IndustryDisputeRules {
|
|
8
|
+
category: string;
|
|
9
|
+
sla_tiers?: DisputeSlaTier[];
|
|
10
|
+
expert_sla?: {
|
|
11
|
+
qualification_required?: boolean;
|
|
12
|
+
description?: string;
|
|
13
|
+
};
|
|
14
|
+
fault_rules?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface ComplianceRules {
|
|
17
|
+
jurisdiction?: string;
|
|
18
|
+
category: string;
|
|
19
|
+
refund_window?: {
|
|
20
|
+
days?: number;
|
|
21
|
+
not_applicable?: boolean;
|
|
22
|
+
description?: string;
|
|
23
|
+
};
|
|
24
|
+
prepay_mode?: string;
|
|
25
|
+
qualification?: string[];
|
|
26
|
+
disclosure?: string[];
|
|
27
|
+
}
|
|
28
|
+
export interface SupplyRules {
|
|
29
|
+
category: string;
|
|
30
|
+
supplier_qualification?: string[];
|
|
31
|
+
first_order_policy?: string;
|
|
32
|
+
redundancy_required?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface IndustryRule {
|
|
35
|
+
rule_id: string;
|
|
36
|
+
dimension?: string;
|
|
37
|
+
description: string;
|
|
38
|
+
severity?: "hard" | "soft";
|
|
39
|
+
red_flag?: boolean;
|
|
40
|
+
condition_hint?: string;
|
|
41
|
+
condition?: IndustryRuleCondition;
|
|
42
|
+
}
|
|
43
|
+
export type IndustryRuleOperator = "truthy" | "falsy" | "missing" | "present" | "eq" | "neq";
|
|
44
|
+
export interface IndustryRuleCondition {
|
|
45
|
+
field: string;
|
|
46
|
+
op: IndustryRuleOperator;
|
|
47
|
+
value?: unknown;
|
|
48
|
+
}
|
|
49
|
+
export interface IndustryRules {
|
|
50
|
+
category: string;
|
|
51
|
+
rules: IndustryRule[];
|
|
52
|
+
}
|
|
53
|
+
export interface IndustryPlaybook {
|
|
54
|
+
category: string;
|
|
55
|
+
content: string;
|
|
56
|
+
}
|
|
57
|
+
export declare function registerDisputeRules(rules: IndustryDisputeRules, replace?: boolean): boolean;
|
|
58
|
+
export declare function registerComplianceRules(rules: ComplianceRules, replace?: boolean): boolean;
|
|
59
|
+
export declare function registerSupplyRules(rules: SupplyRules, replace?: boolean): boolean;
|
|
60
|
+
export declare function registerIndustryRules(rules: IndustryRules, replace?: boolean): boolean;
|
|
61
|
+
export declare function registerIndustryPlaybook(playbook: IndustryPlaybook, replace?: boolean): boolean;
|
|
62
|
+
export declare function resolveDisputeRules(category?: string): IndustryDisputeRules | undefined;
|
|
63
|
+
export declare function resolveComplianceRules(category?: string): ComplianceRules | undefined;
|
|
64
|
+
export declare function resolveSupplyRules(category?: string): SupplyRules | undefined;
|
|
65
|
+
export declare function resolveIndustryRules(category?: string): IndustryRules | undefined;
|
|
66
|
+
export declare function resolveIndustryPlaybook(category?: string): IndustryPlaybook | undefined;
|
|
67
|
+
export declare function listRegisteredDisputeCategories(): string[];
|
|
68
|
+
export declare function listRegisteredComplianceCategories(): string[];
|
|
69
|
+
export declare function listRegisteredSupplyCategories(): string[];
|
|
70
|
+
export declare function listRegisteredIndustryRuleCategories(): string[];
|
|
71
|
+
export declare function listRegisteredPlaybookCategories(): string[];
|
|
72
|
+
export declare function compileIndustryRule(category: string, rule: IndustryRule): EvaluationRule | null;
|
|
73
|
+
export declare function compileIndustryRules(rules: IndustryRules): EvaluationRule[];
|
|
74
|
+
export declare function registerIndustryRulesToEngine(rules: IndustryRules): number;
|
|
75
|
+
export declare function unregisterIndustryRulesFromEngine(category: string): number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getEvaluationEngine}from'../evaluation/engine.js';const disputeRules=new Map(),complianceRules=new Map(),supplyRules=new Map(),industryRules=new Map(),playbooks=new Map();function keyOf(a){return a['toLowerCase']();}export function registerDisputeRules(a,b=![]){const c=keyOf(a['category']);if(!c)return![];if(disputeRules['has'](c)&&!b)return![];return disputeRules['set'](c,a),!![];}export function registerComplianceRules(a,b=![]){const c=keyOf(a['category']);if(!c)return![];if(complianceRules['has'](c)&&!b)return![];return complianceRules['set'](c,a),!![];}export function registerSupplyRules(a,b=![]){const c=keyOf(a['category']);if(!c)return![];if(supplyRules['has'](c)&&!b)return![];return supplyRules['set'](c,a),!![];}export function registerIndustryRules(a,b=![]){const c=keyOf(a['category']);if(!c)return![];if(industryRules['has'](c)&&!b)return![];return industryRules['set'](c,a),!![];}export function registerIndustryPlaybook(a,b=![]){const c=keyOf(a['category']);if(!c)return![];if(playbooks['has'](c)&&!b)return![];return playbooks['set'](c,a),!![];}export function resolveDisputeRules(a){if(!a)return undefined;return disputeRules['get'](keyOf(a));}export function resolveComplianceRules(a){if(!a)return undefined;return complianceRules['get'](keyOf(a));}export function resolveSupplyRules(a){if(!a)return undefined;return supplyRules['get'](keyOf(a));}export function resolveIndustryRules(a){if(!a)return undefined;return industryRules['get'](keyOf(a));}export function resolveIndustryPlaybook(a){if(!a)return undefined;return playbooks['get'](keyOf(a));}export function listRegisteredDisputeCategories(){return Array['from'](disputeRules['keys']());}export function listRegisteredComplianceCategories(){return Array['from'](complianceRules['keys']());}export function listRegisteredSupplyCategories(){return Array['from'](supplyRules['keys']());}export function listRegisteredIndustryRuleCategories(){return Array['from'](industryRules['keys']());}export function listRegisteredPlaybookCategories(){return Array['from'](playbooks['keys']());}function lookupFact(a,b){if(b in a['facts'])return a['facts'][b];if(b in a['entities'])return a['entities'][b];return undefined;}function evaluateCondition(a,b){const c=lookupFact(b,a['field']);switch(a['op']){case'truthy':return!!c;case'falsy':return!c;case'missing':return c===undefined||c===null;case'present':return c!==undefined&&c!==null;case'eq':return c===a['value'];case'neq':return c!==a['value'];default:return![];}}export function compileIndustryRule(a,b){if(!b['condition'])return null;const c='pack.'+a+'.'+b['rule_id'],d=b['severity']==='hard'?0xa:0x5,e=b['condition'];return{'id':c,'description':b['description'],'dimension':b['dimension']??'industry','weight':d,'evaluate'(f){const g=evaluateCondition(e,f);if(g)return{'score':0x64,'weight':d,'reason':b['description'],'matched':[b['description']]};return{'score':0x0,'weight':d,'reason':b['description'],'mismatched':[b['description']],'red_flag':b['red_flag']===!![]};}};}export function compileIndustryRules(a){const b=[];for(const c of a['rules']){const d=compileIndustryRule(a['category'],c);if(d)b['push'](d);}return b;}export function registerIndustryRulesToEngine(a){const b=getEvaluationEngine();let c=0x0;for(const d of compileIndustryRules(a)){b['unregisterRule'](d['id']);if(b['registerRule'](d))c++;}return c;}export function unregisterIndustryRulesFromEngine(a){const b=getEvaluationEngine(),c='pack.'+a+'.';let d=0x0;for(const e of b['listRules']()){e['id']['startsWith'](c)&&b['unregisterRule'](e['id'])&&d++;}return d;}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import type { IndustryMode } from "./types.js";
|
|
2
|
+
import type { CategoryMatchRules } from "../evaluation/category-match-rules.js";
|
|
3
|
+
import { type IndustryPersona } from "../persona/pack-personae.js";
|
|
4
|
+
import { type IndustryDisputeRules, type ComplianceRules, type SupplyRules, type IndustryRules, type IndustryPlaybook } from "./industry-layers.js";
|
|
5
|
+
export type IndustryPackLayout = "merged" | "legacy";
|
|
6
|
+
export interface IndustryPackManifest {
|
|
7
|
+
pack: "industry-pack";
|
|
8
|
+
name: string;
|
|
9
|
+
display_name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
author?: string;
|
|
12
|
+
traits?: Record<string, unknown>;
|
|
13
|
+
depends_on?: string[];
|
|
14
|
+
layers: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface MergedIndustryPack {
|
|
17
|
+
manifest: IndustryPackManifest;
|
|
18
|
+
mode?: IndustryMode | null;
|
|
19
|
+
match?: CategoryMatchRules | null;
|
|
20
|
+
personae?: IndustryPersona[] | null;
|
|
21
|
+
dispute?: IndustryDisputeRules | null;
|
|
22
|
+
compliance?: ComplianceRules | null;
|
|
23
|
+
supply?: SupplyRules | null;
|
|
24
|
+
rules?: IndustryRules | null;
|
|
25
|
+
}
|
|
26
|
+
export interface IndustryPack {
|
|
27
|
+
layout?: IndustryPackLayout;
|
|
28
|
+
manifest: IndustryPackManifest;
|
|
29
|
+
mode?: IndustryMode;
|
|
30
|
+
match?: CategoryMatchRules;
|
|
31
|
+
personae?: IndustryPersona[];
|
|
32
|
+
dispute?: IndustryDisputeRules;
|
|
33
|
+
compliance?: ComplianceRules;
|
|
34
|
+
supply?: SupplyRules;
|
|
35
|
+
rules?: IndustryRules;
|
|
36
|
+
playbook?: IndustryPlaybook;
|
|
37
|
+
}
|
|
38
|
+
export interface PackValidation {
|
|
39
|
+
valid: boolean;
|
|
40
|
+
errors: string[];
|
|
41
|
+
}
|
|
42
|
+
export interface PackRegistrationResult {
|
|
43
|
+
ok: boolean;
|
|
44
|
+
errors: string[];
|
|
45
|
+
registered: string[];
|
|
46
|
+
}
|
|
47
|
+
export interface PackRecord {
|
|
48
|
+
version: string;
|
|
49
|
+
layers: string[];
|
|
50
|
+
registered_at: number;
|
|
51
|
+
}
|
|
52
|
+
export declare function validatePackManifest(manifest: IndustryPackManifest): PackValidation;
|
|
53
|
+
export declare function registerIndustryPack(pack: IndustryPack, force?: boolean): PackRegistrationResult;
|
|
54
|
+
export declare function listRegisteredPacks(): Array<PackRecord & {
|
|
55
|
+
name: string;
|
|
56
|
+
}>;
|
|
57
|
+
export declare function unregisterIndustryPack(name: string): boolean;
|
|
58
|
+
export interface PackDiffResult {
|
|
59
|
+
name: string;
|
|
60
|
+
registered: {
|
|
61
|
+
version: string;
|
|
62
|
+
layers: string[];
|
|
63
|
+
registered_at: number;
|
|
64
|
+
} | null;
|
|
65
|
+
disk: {
|
|
66
|
+
version: string;
|
|
67
|
+
layers: string[];
|
|
68
|
+
} | null;
|
|
69
|
+
upgradable: boolean;
|
|
70
|
+
layer_diff: {
|
|
71
|
+
added: string[];
|
|
72
|
+
removed: string[];
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export declare function diffIndustryPack(name: string): PackDiffResult;
|
|
76
|
+
export declare function scanPacks(dir: string): PackRegistrationResult[];
|
|
77
|
+
export declare function rescanPack(name: string): PackRegistrationResult;
|
|
78
|
+
export declare function resolveIndustryPackDir(): string;
|
|
79
|
+
export declare function scanDefaultIndustryPacks(): PackRegistrationResult[];
|
|
80
|
+
export declare function seedBuiltinIndustryTemplates(names?: string[]): string[];
|
|
81
|
+
export interface ScaffoldResult {
|
|
82
|
+
ok: boolean;
|
|
83
|
+
dir: string;
|
|
84
|
+
files: string[];
|
|
85
|
+
errors: string[];
|
|
86
|
+
}
|
|
87
|
+
export declare const LAYER_FILE_SECTION: Record<string, keyof Omit<MergedIndustryPack, "manifest" | "personae">>;
|
|
88
|
+
export declare const PERSONAE_DIR = "personae";
|
|
89
|
+
export declare function buildPristineMergedPack(name: string): MergedIndustryPack;
|
|
90
|
+
export declare function industryReadmeContent(): string;
|
|
91
|
+
export declare function ensureIndustryReadme(): string;
|
|
92
|
+
export declare function scaffoldIndustryPack(name: string, dir?: string): ScaffoldResult;
|
|
93
|
+
export declare function readMergedPackIfPresent(packDir: string): MergedIndustryPack | null;
|
|
94
|
+
export interface ResetResult {
|
|
95
|
+
ok: boolean;
|
|
96
|
+
layout: IndustryPackLayout;
|
|
97
|
+
target: string;
|
|
98
|
+
restored_files: string[];
|
|
99
|
+
errors: string[];
|
|
100
|
+
}
|
|
101
|
+
export declare function locatePackAndRemainder(relPath: string): {
|
|
102
|
+
packName: string;
|
|
103
|
+
remainder: string;
|
|
104
|
+
} | null;
|
|
105
|
+
export declare function resetIndustryPath(relPath: string, dir?: string): ResetResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readdirSync,readFileSync,existsSync,mkdirSync,writeFileSync}from'node:fs';import{join}from'node:path';import{getWowokIndustryDir}from'@wowok/wowok';import{getIndustryModeRegistry}from'./registry.js';import{BUILTIN_MODES}from'./modes.js';import{registerCategoryMatchRules}from'../evaluation/category-match-rules.js';import{registerIndustryPersonae,unregisterIndustryPersonae}from'../persona/pack-personae.js';import{PERSONA_ROLES,SUPPORTED_INDUSTRIES}from'../persona/types.js';import{UNIVERSAL_TEMPLATE}from'../knowledge/universal-template.js';import{registerDisputeRules,registerComplianceRules,registerSupplyRules,registerIndustryRules,registerIndustryPlaybook,registerIndustryRulesToEngine}from'./industry-layers.js';const FORBIDDEN_PRICING_MODES=new Set(UNIVERSAL_TEMPLATE['pricing_redlines']),packRegistry=new Map();export function validatePackManifest(a){const b=[];return(!a||a['pack']!=='industry-pack')&&b['push']('manifest.pack\x20must\x20be\x20\x27industry-pack\x27'),(!a['name']||typeof a['name']!=='string')&&b['push']('manifest.name\x20is\x20required'),(!a['version']||typeof a['version']!=='string')&&b['push']('manifest.version\x20is\x20required'),(!Array['isArray'](a['layers'])||a['layers']['length']===0x0)&&b['push']('manifest.layers\x20must\x20be\x20a\x20non-empty\x20array'),{'valid':b['length']===0x0,'errors':b};}function isMeaningfulMatch(a){if(!a)return![];return(a['hard_constraints']?.['length']??0x0)>0x0||Object['keys'](a['soft_weights']??{})['length']>0x0||(a['pricing_rules']?.['length']??0x0)>0x0||(a['highlight_fields']?.['length']??0x0)>0x0;}function isMeaningfulPersona(a){const b=a['long_term']??{},c=a['current']??{};return(c['strategy']?.['length']??0x0)>0x0||(c['requirements']?.['length']??0x0)>0x0||(c['rules']?.['length']??0x0)>0x0||(c['spec']?.['length']??0x0)>0x0||Object['keys'](c['preferences']??{})['length']>0x0||Object['keys'](b['preferences']??{})['length']>0x0||(b['identity']?.['region']?.['length']??0x0)>0x0||(b['identity']?.['languages']?.['length']??0x0)>0x0;}function isMeaningfulDispute(a){return(a?.['sla_tiers']?.['length']??0x0)>0x0||(a?.['fault_rules']?.['length']??0x0)>0x0;}function isMeaningfulCompliance(a){return!!a?.['prepay_mode']||(a?.['qualification']?.['length']??0x0)>0x0||(a?.['disclosure']?.['length']??0x0)>0x0||a?.['refund_window']?.['days']!==undefined&&!a?.['refund_window']?.['not_applicable'];}function isMeaningfulSupply(a){return(a?.['supplier_qualification']?.['length']??0x0)>0x0||!!a?.['first_order_policy']||a?.['redundancy_required']===!![];}function isMeaningfulRules(a){return(a?.['rules']?.['length']??0x0)>0x0;}function isMeaningfulPlaybook(a){if(!a)return![];const b=a['content']??'',c=b['replace'](/# .*Industry Playbook/g,'')['replace'](/> .*/g,'')['replace'](/## (Experience|Strategy|Personalization)/g,'')['replace'](/- \(Add .*\)/g,'')['trim']();return c['length']>0x0;}export function registerIndustryPack(a,b=![]){const c=[],d=[],e=a['manifest'],f=validatePackManifest(e);c['push'](...f['errors']);if(!f['valid'])return{'ok':![],'errors':c,'registered':d};const g=packRegistry['get'](e['name']),h=g!==undefined&&g['version']!==e['version'],i=h||b;if(e['layers']['includes']('mode')){if(!a['mode'])c['push']('pack\x20\x27'+e['name']+'\x27\x20declares\x20layer\x20\x27mode\x27\x20but\x20mode.json\x20is\x20missing');else{const j=getIndustryModeRegistry();i&&j['hasMode'](a['mode']['name'])&&j['unregisterMode'](a['mode']['name']),!j['registerMode'](a['mode'])?c['push']('mode\x20\x27'+a['mode']['name']+'\x27\x20failed\x20to\x20register\x20(already\x20registered?).\x20'+'Unregister\x20first\x20or\x20upgrade\x20with\x20a\x20different\x20version.'):d['push']('mode');}}if(e['layers']['includes']('match')){if(!a['match'])c['push']('pack\x20\x27'+e['name']+'\x27\x20declares\x20layer\x20\x27match\x27\x20but\x20match.json\x20is\x20missing');else{if(!isMeaningfulMatch(a['match'])){}else{const k=a['match']['pricing_rules']['filter'](l=>FORBIDDEN_PRICING_MODES['has'](l));if(k['length']>0x0)c['push']('match.pricing_rules\x20contains\x20forbidden\x20modes:\x20'+k['join'](',\x20')+'\x20'+'(violates\x20upper-layer\x20pricing\x20red\x20lines,\x20K3\x2015\x20§4.2)');else!registerCategoryMatchRules(a['match'],i)?c['push']('match\x20rules\x20for\x20\x27'+a['match']['category']+'\x27\x20already\x20registered'):d['push']('match');}}}if(e['layers']['includes']('personae')){if(!a['personae']||a['personae']['length']===0x0)c['push']('pack\x20\x27'+e['name']+'\x27\x20declares\x20layer\x20\x27personae\x27\x20but\x20personae\x20are\x20missing');else{const l=a['personae']['filter'](isMeaningfulPersona);if(l['length']===0x0){}else registerIndustryPersonae(e['name'],l),d['push']('personae');}}if(e['layers']['includes']('dispute')){if(!a['dispute'])c['push']('pack\x20\x27'+e['name']+'\x27\x20declares\x20layer\x20\x27dispute\x27\x20but\x20dispute.json\x20is\x20missing');else{if(!isMeaningfulDispute(a['dispute'])){}else!registerDisputeRules(a['dispute'],i)?c['push']('dispute\x20rules\x20for\x20\x27'+a['dispute']['category']+'\x27\x20already\x20registered'):d['push']('dispute');}}if(e['layers']['includes']('compliance')){if(!a['compliance'])c['push']('pack\x20\x27'+e['name']+'\x27\x20declares\x20layer\x20\x27compliance\x27\x20but\x20compliance.json\x20is\x20missing');else{if(!isMeaningfulCompliance(a['compliance'])){}else!registerComplianceRules(a['compliance'],i)?c['push']('compliance\x20rules\x20for\x20\x27'+a['compliance']['category']+'\x27\x20already\x20registered'):d['push']('compliance');}}if(e['layers']['includes']('supply')){if(!a['supply'])c['push']('pack\x20\x27'+e['name']+'\x27\x20declares\x20layer\x20\x27supply\x27\x20but\x20supply.json\x20is\x20missing');else{if(!isMeaningfulSupply(a['supply'])){}else!registerSupplyRules(a['supply'],i)?c['push']('supply\x20rules\x20for\x20\x27'+a['supply']['category']+'\x27\x20already\x20registered'):d['push']('supply');}}if(e['layers']['includes']('rules')){if(!a['rules'])c['push']('pack\x20\x27'+e['name']+'\x27\x20declares\x20layer\x20\x27rules\x27\x20but\x20rules.json\x20is\x20missing');else{if(!isMeaningfulRules(a['rules'])){}else!registerIndustryRules(a['rules'],i)?c['push']('industry\x20rules\x20for\x20\x27'+a['rules']['category']+'\x27\x20already\x20registered'):(d['push']('rules'),registerIndustryRulesToEngine(a['rules']));}}if(e['layers']['includes']('playbook')){if(!a['playbook'])c['push']('pack\x20\x27'+e['name']+'\x27\x20declares\x20layer\x20\x27playbook\x27\x20but\x20playbook.md\x20is\x20missing');else{if(!isMeaningfulPlaybook(a['playbook'])){}else!registerIndustryPlaybook(a['playbook'],i)?c['push']('playbook\x20for\x20\x27'+a['playbook']['category']+'\x27\x20already\x20registered'):d['push']('playbook');}}return c['length']===0x0&&packRegistry['set'](e['name'],{'version':e['version'],'layers':[...e['layers']],'registered_at':Date['now']()}),{'ok':c['length']===0x0,'errors':c,'registered':d};}let builtinModesAsPacksRegistered=![];function ensureBuiltinModesAsPacks(){if(builtinModesAsPacksRegistered)return;builtinModesAsPacksRegistered=!![];for(const a of BUILTIN_MODES){if(packRegistry['has'](a['name']))continue;packRegistry['set'](a['name'],{'version':a['version'],'layers':['mode','match'],'registered_at':Date['now']()});}}export function listRegisteredPacks(){return ensureBuiltinModesAsPacks(),Array['from'](packRegistry['entries']())['map'](([a,b])=>({'name':a,...b}));}export function unregisterIndustryPack(a){const b=new Set(BUILTIN_MODES['map'](c=>c['name']));if(b['has'](a))return![];if(!packRegistry['has'](a))return![];return packRegistry['delete'](a),unregisterIndustryPersonae(a),!![];}export function diffIndustryPack(a){const b=packRegistry['get'](a)??null,c=resolveIndustryPackDir(),d=join(c,a),e=readMergedPackIfPresent(d);let f=null;try{if(e&&e['manifest'])f={'version':e['manifest']['version'],'layers':e['manifest']['layers']??[]};else{const l=join(d,'manifest.json');if(existsSync(l)){const m=JSON['parse'](readFileSync(l,'utf-8'));f={'version':m['version'],'layers':m['layers']??[]};}}}catch{f=null;}const g=b?.['layers']??[],h=f?.['layers']??[],i=h['filter'](n=>!g['includes'](n)),j=g['filter'](n=>!h['includes'](n)),k=!!b&&!!f&&(b['version']!==f['version']||i['length']>0x0||j['length']>0x0);return{'name':a,'registered':b?{...b,'layers':[...b['layers']]}:null,'disk':f,'upgradable':k,'layer_diff':{'added':i,'removed':j}};}export function scanPacks(a){const b=[];if(!existsSync(a))return b;for(const c of readdirSync(a,{'withFileTypes':!![]})){if(!c['isDirectory']())continue;const d=join(a,c['name']);try{const e=loadPackFromDir(d);if(!e)continue;b['push'](registerIndustryPack(e));}catch(f){b['push']({'ok':![],'errors':['failed\x20to\x20load\x20pack\x20\x27'+c['name']+'\x27:\x20'+f['message']],'registered':[]});}}return b;}function loadPackFromDir(a){const b=readMergedPackIfPresent(a),c=join(a,'manifest.json'),d=existsSync(c);if(!b&&!d)return null;if(b){const p=b['manifest'],q={'layout':'merged','manifest':p};if(b['mode'])q['mode']=b['mode'];if(b['match'])q['match']=b['match'];b['personae']&&Array['isArray'](b['personae'])&&(q['personae']=b['personae']);if(b['dispute'])q['dispute']=b['dispute'];if(b['compliance'])q['compliance']=b['compliance'];if(b['supply'])q['supply']=b['supply'];if(b['rules'])q['rules']=b['rules'];const r=join(a,'playbook.md');return existsSync(r)&&(q['playbook']={'category':p['name'],'content':readFileSync(r,'utf-8')}),q;}const e=JSON['parse'](readFileSync(c,'utf-8')),g={'layout':'legacy','manifest':e},h=join(a,'mode.json'),i=join(a,'match.json');existsSync(h)&&(g['mode']=JSON['parse'](readFileSync(h,'utf-8')));existsSync(i)&&(g['match']=JSON['parse'](readFileSync(i,'utf-8')));const j=join(a,'personae');if(existsSync(j)){const s=[];for(const t of readdirSync(j)){if(!t['endsWith']('.json'))continue;s['push'](JSON['parse'](readFileSync(join(j,t),'utf-8')));}if(s['length']>0x0)g['personae']=s;}const k=join(a,'dispute.json');existsSync(k)&&(g['dispute']=JSON['parse'](readFileSync(k,'utf-8')));const l=join(a,'compliance.json');existsSync(l)&&(g['compliance']=JSON['parse'](readFileSync(l,'utf-8')));const m=join(a,'supply.json');existsSync(m)&&(g['supply']=JSON['parse'](readFileSync(m,'utf-8')));const n=join(a,'rules.json');existsSync(n)&&(g['rules']=JSON['parse'](readFileSync(n,'utf-8')));const o=join(a,'playbook.md');return existsSync(o)&&(g['playbook']={'category':e['name'],'content':readFileSync(o,'utf-8')}),g;}export function rescanPack(a){const b=join(resolveIndustryPackDir(),a);try{const c=loadPackFromDir(b);if(!c)return{'ok':![],'errors':['no\x20pack\x20found\x20for\x20\x27'+a+'\x27'],'registered':[]};return registerIndustryPack(c,!![]);}catch(d){return{'ok':![],'errors':['failed\x20to\x20rescan\x20pack\x20\x27'+a+'\x27:\x20'+d['message']],'registered':[]};}}export function resolveIndustryPackDir(){return process['env']['WOWOK_INDUSTRY_DIR']||getWowokIndustryDir();}export function scanDefaultIndustryPacks(){return seedBuiltinIndustryTemplates(),ensureIndustryReadme(),ensureBuiltinModesAsPacks(),scanPacks(resolveIndustryPackDir());}export function seedBuiltinIndustryTemplates(a=SUPPORTED_INDUSTRIES){const b=[],c=resolveIndustryPackDir();mkdirSync(c,{'recursive':!![]}),ensureIndustryReadme();for(const d of a){const e=join(c,d);if(existsSync(join(e,'manifest.json'))||existsSync(join(e,'pack.json')))continue;const f=scaffoldIndustryPack(d,c);if(f['ok'])b['push'](d);}return b;}export const LAYER_FILE_SECTION={'match.json':'match','dispute.json':'dispute','compliance.json':'compliance','supply.json':'supply','rules.json':'rules','mode.json':'mode'};export const PERSONAE_DIR='personae';function manifestSection(a){return{'pack':'industry-pack','name':a,'display_name':a,'version':'0.1.0','layers':['match','personae','dispute','compliance','supply','rules','playbook']};}function matchSection(a){return{'category':a,'hard_constraints':[],'soft_weights':{},'highlight_fields':[],'calendar_mode':'none','geo_mode':'strict','pricing_rules':[]};}function personaPerRole(a,b){return{'role':a,'industry':b,'long_term':{'identity':{'self_description':b+'\x20'+a},'preferences':{}},'current':{'strategy':[],'requirements':[],'rules':[],'spec':'','preferences':{}}};}function disputeSection(a){return{'category':a,'sla_tiers':[],'fault_rules':[]};}function complianceSection(a){return{'category':a,'prepay_mode':'','qualification':[],'disclosure':[],'refund_window':{'days':0x7,'not_applicable':![]}};}function supplySection(a){return{'category':a,'supplier_qualification':[],'first_order_policy':'','redundancy_required':![]};}function rulesSection(a){return{'category':a,'rules':[]};}export function buildPristineMergedPack(a){const b=PERSONA_ROLES['map'](c=>personaPerRole(c,a));return{'manifest':manifestSection(a),'match':matchSection(a),'personae':b,'dispute':disputeSection(a),'compliance':complianceSection(a),'supply':supplySection(a),'rules':rulesSection(a),'mode':null};}export function industryReadmeContent(){return['#\x20WoWok\x20Industry\x20Packs','','>\x20This\x20folder\x20is\x20the\x20WoWok\x20industry\x20knowledge\x20root.\x20Each\x20sub-folder\x20is\x20one','>\x20industry\x20pack.\x20The\x20AI\x20reads\x20pack\x20data\x20as\x20context\x20on\x20every\x20chat\x20turn.','','##\x20Pack\x20structure\x20(unified\x20layout)','','Every\x20pack\x20is\x20exactly\x20two\x20files:','','-\x20**`<pack>/pack.json`**\x20—\x20machine-checkable\x20**settings\x20only**.\x20No\x20comments,','\x20\x20no\x20documentation.\x20One\x20section\x20per\x20layer\x20(see\x20below).','-\x20**`<pack>/playbook.md`**\x20—\x20human\x20strategy,\x20tone\x20and\x20field-tested\x20experience.','\x20\x20The\x20AI\x20reads\x20it\x20as\x20context\x20and\x20it\x20OVERRIDES\x20built-in\x20industry\x20data\x20for','\x20\x20this\x20account.','','All\x20field\x20explanations\x20live\x20in\x20THIS\x20file,\x20so\x20pack.json\x20stays\x20small\x20and\x20you','can\x20focus\x20on\x20configuration.\x20The\x20editor\x20also\x20validates\x20JSON\x20on\x20save\x20—\x20a\x20file','that\x20fails\x20to\x20parse\x20(or\x20a\x20pack.json\x20missing\x20its\x20manifest)\x20is\x20blocked.','','##\x20How\x20changes\x20take\x20effect','','1.\x20**Save**\x20in\x20the\x20Editor\x20writes\x20bytes\x20to\x20disk.','2.\x20**Scan**\x20(Industry\x20drawer)\x20re-registers\x20each\x20pack\x20into\x20the\x20runtime\x20AI','\x20\x20\x20registry\x20(and\x20SQLite\x20cache).\x20A\x20save\x20of\x20an\x20industry\x20file\x20already\x20runs','\x20\x20\x20Scan\x20automatically.','3.\x20**Next\x20AI\x20chat\x20turn**\x20the\x20L1\x20prompt\x20builder\x20reads\x20the\x20registered\x20layers,','\x20\x20\x20so\x20the\x20AI\x20reasons\x20against\x20your\x20edited\x20rules\x20from\x20that\x20point\x20onward.','','##\x20manifest\x20—\x20pack\x20metadata\x20+\x20layer\x20ENABLE\x20flags','','-\x20`name`:\x20snake_case\x20identifier,\x20must\x20match\x20the\x20folder\x20name.','-\x20`version`:\x20bump\x20after\x20editing\x20content\x20so\x20the\x20registry\x20treats\x20it\x20as\x20an\x20upgrade.','-\x20`display_name`:\x20user-visible\x20label.','-\x20`layers`:\x20which\x20sections\x20are\x20validated\x20and\x20registered\x20on\x20scan.\x20Remove\x20a','\x20\x20layer\x20name\x20to\x20DISABLE\x20it\x20(the\x20section\x20stays\x20in\x20pack.json\x20but\x20is\x20ignored).','','##\x20match\x20—\x20category-match\x20rules','','Decides\x20whether\x20an\x20order/service/account\x20belongs\x20to\x20this\x20industry\x20pack:','-\x20`hard_constraints`:\x20array\x20of\x20REQUIRED\x20predicates;\x20ALL\x20must\x20match\x20before\x20the','\x20\x20pack\x20is\x20considered.\x20Example:','\x20\x20`[{\x20key:\x20\x27order.metadata.service_kind\x27,\x20equals:\x20\x27food_onsite\x27\x20}]`','-\x20`soft_weights`:\x20dict\x20`<heuristic_key:\x20number\x200..1>`;\x20higher\x20=\x20stronger\x20signal.','-\x20`pricing_rules`:\x20pricing\x20modes\x20this\x20industry\x20requires.','-\x20`highlight_fields`:\x20dot-paths\x20surfaced\x20in\x20the\x20UI\x20as\x20important\x20info.','-\x20`geo_mode`:\x20`\x27strict\x27`\x20(region\x20must\x20match)\x20|\x20`\x27none\x27`\x20(ignore\x20region).','-\x20`calendar_mode`:\x20`\x27seasonal\x27`\x20|\x20`\x27weekday\x27`\x20|\x20`\x27none\x27`.','','##\x20personae\x20—\x20per-role\x20AI\x20personas','','One\x20persona\x20per\x20role\x20(`merchant`,\x20`customer`,\x20`supplier`,\x20`collaborator`,','`arbitrator`,\x20`prospect`).\x20The\x20AI\x20uses\x20them\x20to\x20role-play\x20negotiation\x20posture:','-\x20`long_term`:\x20stable\x20properties\x20—\x20`identity.self_description`\x20(free-text\x20bio),','\x20\x20`identity.region/languages`,\x20`preferences`\x20(`<key:\x20string[]>`).','-\x20`current`:\x20per-negotiation\x20posture\x20—\x20`strategy`\x20(moves\x20to\x20make),','\x20\x20`requirements`\x20(non-negotiable\x20demands),\x20`rules`\x20(constraints/axioms),','\x20\x20`spec`\x20(free-form\x20text),\x20`preferences`\x20(per-turn\x20overrides).','','##\x20dispute\x20—\x20SLA\x20tiers\x20+\x20fault\x20assignment','','-\x20`sla_tiers[]`:\x20response/remedy\x20windows\x20per\x20severity\x20level.','\x20\x20Example:\x20`{\x20level:\x20\x27L1\x27,\x20response_hours:\x2024,\x20remedy:\x20\x27reply\x27\x20}`','-\x20`fault_rules[]`:\x20automatic\x20fault\x20attribution\x20—\x20a\x20condition\x20plus\x20the\x20side','\x20\x20that\x20bears\x20fault\x20(`merchant`/`customer`/`supplier`/`operator`/`shared`).','\x20\x20Example:\x20`{\x20when:\x20{\x20evidence_has:\x20[\x27late\x20delivery\x20photo\x27]\x20},\x20assign_to:\x20\x27merchant\x27,\x20weight:\x201.0\x20}`','','##\x20compliance\x20—\x20hard\x20requirements\x20before\x20checkout','','-\x20`prepay_mode`:\x20`\x27\x27`\x20|\x20`\x27full\x27`\x20|\x20`\x27partial\x27`\x20|\x20`\x27deposit\x27`.','-\x20`qualification[]`:\x20licenses/certifications\x20a\x20merchant\x20must\x20hold.','\x20\x20Example:\x20`{\x20label:\x20\x27Food\x20Service\x20License\x27,\x20required:\x20true,\x20region:\x20\x27CN\x27\x20}`','-\x20`disclosure[]`:\x20text\x20the\x20merchant\x20MUST\x20show\x20buyers\x20up-front.','-\x20`refund_window`:\x20`{\x20days:\x20number,\x20not_applicable:\x20boolean,\x20exceptions:\x20[...]\x20}`','','##\x20supply\x20—\x20supply-chain\x20/\x20supplier\x20qualification','','-\x20`supplier_qualification[]`:\x20same\x20shape\x20as\x20compliance\x20qualifications,\x20but','\x20\x20evaluated\x20on\x20the\x20SUPPLIER\x20side\x20(multi-party\x20orders).','-\x20`first_order_policy`:\x20policy\x20string\x20on\x20the\x20first\x20order\x20from\x20a\x20new\x20supplier','\x20\x20(e.g.\x20`\x27sample-only\x27`,\x20`\x27reduced-quantity\x27`).','-\x20`redundancy_required`:\x20true\x20=\x20require\x20≥2\x20eligible\x20suppliers\x20before\x20accepting','\x20\x20an\x20order\x20(mitigates\x20single-sourcing).','','##\x20rules\x20—\x20declarative\x20machine-checked\x20rules','','Each\x20rule\x20is\x20an\x20AST\x20node\x20compiled\x20into\x20the\x20evaluation\x20engine:','`{\x20id:\x20\x27rule_...\x27,\x20when:\x20<bool-condition>,\x20then:\x20\x27reject\x27\x20|\x20\x27warn\x27\x20|\x20\x27flag\x27,\x20message:\x20\x27Text\x27\x20}`','Use\x20`rules`\x20for\x20rules\x20that\x20must\x20be\x20machine-checked;\x20put\x20human\x20strategy\x20in','`playbook.md`.','','##\x20mode\x20—\x20IndustryMode\x20(deep\x20shape)','','Not\x20scaffolded\x20by\x20default.\x20Add\x20it\x20when\x20you\x20need\x20a\x20full\x20driving\x20mode\x20for\x20the','industry,\x20or\x20ask\x20the\x20AI:\x20\x22help\x20me\x20fill\x20mode\x20for\x20<industry>\x22.','','##\x20Reset','','Right-click\x20any\x20file/pack\x20folder\x20in\x20the\x20Industry\x20drawer\x20and\x20choose\x20*Reset*','to\x20restore\x20the\x20pristine\x20template\x20at\x20any\x20time.','']['join']('\x0a');}export function ensureIndustryReadme(){const a=resolveIndustryPackDir();mkdirSync(a,{'recursive':!![]});const b=join(a,'README.md');return writeFileSync(b,industryReadmeContent(),'utf-8'),b;}export function scaffoldIndustryPack(a,b){const c=join(b??resolveIndustryPackDir(),a),d=[],e=[];if(!/^[a-z][a-z0-9_]*$/['test'](a))return{'ok':![],'dir':c,'files':d,'errors':['industry\x20name\x20\x27'+a+'\x27\x20must\x20be\x20lowercase\x20snake_case\x20(a-z,\x200-9,\x20_)']};try{mkdirSync(c,{'recursive':!![]}),ensureIndustryReadme();const f=buildPristineMergedPack(a);return writeFileSync(join(c,'pack.json'),JSON['stringify'](f,null,0x2)+'\x0a'),d['push']('pack.json'),writeFileSync(join(c,'playbook.md'),playbookTemplate(a)),d['push']('playbook.md'),{'ok':!![],'dir':c,'files':d,'errors':e};}catch(g){return{'ok':![],'dir':c,'files':d,'errors':['scaffold\x20failed:\x20'+g['message']]};}}export function readMergedPackIfPresent(a){const b=join(a,'pack.json');if(!existsSync(b))return null;try{const c=readFileSync(b,'utf-8');return JSON['parse'](c);}catch{return null;}}function playbookTemplate(a){return['#\x20'+a+'\x20—\x20Industry\x20Playbook','','>\x20📘\x20This\x20file\x20captures\x20human\x20business\x20intelligence\x20for\x20the\x20`'+a+'`','>\x20industry.\x20Content\x20here\x20is\x20READ\x20BY\x20THE\x20AI\x20AS\x20CONTEXT\x20on\x20every\x20turn,','>\x20and\x20OVERRIDES\x20WoWok\x27s\x20generic\x20built-in\x20industry\x20data/rules\x20for\x20this','>\x20account.\x20The\x20companion\x20`pack.json`\x20file\x20stores\x20machine-checkable','>\x20rules;\x20THIS\x20file\x20stores\x20human\x20strategy,\x20tone,\x20experience,\x20and\x20ethics.','','>\x20💡\x20Hint\x20for\x20the\x20AI:\x20when\x20the\x20user\x20asks\x20a\x20question\x20about\x20\x22how\x20to','>\x20handle\x20'+a+'\x22\x20or\x20\x22what\x20should\x20I\x20do?\x22,\x20check\x20this\x20file\x20first\x20for\x20the','>\x20merchant/customer\x20voice,\x20then\x20fall\x20back\x20to\x20your\x20built-in\x20data.\x20Cite','>\x20section\x20titles\x20in\x20your\x20reply\x20so\x20the\x20user\x20knows\x20where\x20advice\x20comes\x20from.','','##\x20Experience\x20(Field-Tested\x20Rules\x20of\x20Thumb)','','>\x20Write\x20what\x20actually\x20works\x20in\x20this\x20industry\x20—\x20not\x20what\x20textbooks\x20say.','>\x20Short\x20bullet\x20points\x20preferred;\x20the\x20AI\x20reads\x20them\x20as\x20axioms.\x20Include','>\x20specific\x20numbers\x20when\x20you\x20have\x20them.','','-\x20(Example)\x20\x22Catering:\x20if\x20the\x20event\x20starts\x20before\x2010:00,\x20always\x20assume','\x20\x20the\x20customer\x20wants\x20breakfast\x20service\x20too\x20—\x20upsell\x20it\x20proactively.\x22','-\x20(Example)\x20\x22Common\x20pitfall:\x20last-minute\x20menu\x20swaps\x20on\x20Fridays\x20—\x20require','\x20\x20a\x20written\x20change\x20request\x2048\x20h\x20before\x20the\x20event\x20or\x20charge\x20a\x2015%\x20fee.\x22','-\x20(Add\x20more\x20below\x20—\x20delete\x20the\x20examples\x20above\x20when\x20you\x20have\x20real\x20ones.)','','##\x20Strategy\x20(Competitive\x20/\x20Game-Theory)','','>\x20How\x20should\x20each\x20role\x20act\x20in\x20a\x20negotiation\x20/\x20dispute\x20/\x20supplier','>\x20relationship?\x20Think\x20in\x20\x22always\x20/\x20never\x20/\x20depends-on-X\x22\x20rules,\x20and\x20call','>\x20out\x20the\x20trade-offs.','','-\x20Merchant\x20strategy:\x20(Add\x20how\x20a\x20merchant\x20in\x20this\x20industry\x20should\x20act\x20—','\x20\x20price\x20anchoring,\x20which\x20concessions\x20to\x20give\x20early\x20vs\x20late,\x20what\x20to','\x20\x20never\x20concede\x20on,\x20etc.)','-\x20Customer\x20strategy:\x20(Add\x20what\x20a\x20smart\x20customer\x20should\x20push\x20for.)','-\x20Dispute\x20strategy:\x20(When\x20to\x20settle\x20fast\x20vs\x20when\x20to\x20fight\x20for\x20full','\x20\x20evidence\x20+\x20arbitration.\x20Call\x20out\x20the\x20escalation\x20thresholds.)','','##\x20Personalization\x20(Tone,\x20Brand,\x20Ethics,\x20Red\x20Lines)','','-\x20Tone\x20/\x20voice:\x20(Write\x20one\x20sentence\x20describing\x20the\x20exact\x20conversational','\x20\x20voice\x20this\x20account\x20should\x20use\x20—\x20casual,\x20formal,\x20technical,\x20etc.)','-\x20Brand\x20rules:\x20(Logo,\x20link-out\x20style,\x20forbidden\x20terminology,','\x20\x20always-include\x20phrases,\x20etc.)','-\x20Red\x20lines:\x20(Non-negotiable.\x20Example:\x20\x22Never\x20make\x20a\x20refund\x20promise','\x20\x20larger\x20than\x2030%\x20without\x20arbitration\x20evidence.\x22)','-\x20Ethics:\x20(Example:\x20\x22If\x20customer\x20appears\x20intoxicated,\x20refuse\x20service','\x20\x20and\x20refer\x20to\x20supervisor;\x20never\x20take\x20the\x20order\x20for\x20profit.\x22)','','##\x20Playbook\x20Maintenance','','>\x20You\x20don\x27t\x20need\x20to\x20be\x20perfect\x20on\x20day\x20one.\x20After\x20every\x20real\x20deal,\x20add\x20a','>\x20bullet\x20to\x20the\x20above\x20sections\x20with\x20what\x20worked\x20/\x20what\x20failed.\x20Every','>\x20entry\x20improves\x20the\x20AI\x27s\x20future\x20decisions.','','>\x20Right-click\x20the\x20file\x20or\x20this\x20pack\x20folder\x20in\x20the\x20Industry\x20drawer\x20at','>\x20any\x20time\x20and\x20choose\x20\x22Reset\x22\x20to\x20restore\x20this\x20annotated\x20template.','']['join']('\x0a');}export function locatePackAndRemainder(a){const b=a['replace'](/^[\\/]+/,'')['replace'](/[\\/]+$/,'');if(!b)return null;const [c,...d]=b['split'](/[\\/]+/);if(!c)return null;return{'packName':c,'remainder':d['join']('/')};}export function resetIndustryPath(a,b){const c=[],d=[],f=b??resolveIndustryPackDir(),g=locatePackAndRemainder(a),h=a;if(!g)return{'ok':![],'layout':'merged','target':h,'restored_files':[],'errors':['invalid\x20reset\x20path\x20\x27'+a+'\x27']};const {packName:i,remainder:j}=g,k=join(f,i);if(!existsSync(k))return{'ok':![],'layout':'merged','target':h,'restored_files':[],'errors':['pack\x20directory\x20\x27'+i+'\x27\x20does\x20not\x20exist']};if(!/^[a-z][a-z0-9_]*$/['test'](i))return{'ok':![],'layout':'merged','target':h,'restored_files':[],'errors':['pack\x20name\x20\x27'+i+'\x27\x20is\x20not\x20a\x20valid\x20snake_case\x20identifier']};const l=readMergedPackIfPresent(k),n=l?'merged':'legacy';if(j==='')try{mkdirSync(k,{'recursive':!![]});const s=buildPristineMergedPack(i);return writeFileSync(join(k,'pack.json'),JSON['stringify'](s,null,0x2)+'\x0a'),d['push']('pack.json'),writeFileSync(join(k,'playbook.md'),playbookTemplate(i)),d['push']('playbook.md'),{'ok':!![],'layout':'merged','target':h,'restored_files':d,'errors':c};}catch(t){return{'ok':![],'layout':n,'target':h,'restored_files':d,'errors':['pack\x20reset\x20failed:\x20'+t['message']]};}const o=j['split']('/')['slice'](-0x1)[0x0],p=j==='playbook.md',q=j['startsWith'](PERSONAE_DIR+'/')&&o['endsWith']('.json');if(n==='merged'){if(p)try{return writeFileSync(join(k,'playbook.md'),playbookTemplate(i)),d['push']('playbook.md'),{'ok':!![],'layout':n,'target':h,'restored_files':d,'errors':c};}catch(v){return{'ok':![],'layout':n,'target':h,'restored_files':d,'errors':['playbook\x20reset\x20failed:\x20'+v['message']]};}const u=LAYER_FILE_SECTION[j];if(u)try{const w=readMergedPackIfPresent(k)??buildPristineMergedPack(i);switch(u){case'match':w['match']=matchSection(i);break;case'dispute':w['dispute']=disputeSection(i);break;case'compliance':w['compliance']=complianceSection(i);break;case'supply':w['supply']=supplySection(i);break;case'rules':w['rules']=rulesSection(i);break;case'mode':w['mode']=null;break;}return writeFileSync(join(k,'pack.json'),JSON['stringify'](w,null,0x2)+'\x0a'),d['push']('pack.json'),{'ok':!![],'layout':n,'target':h,'restored_files':d,'errors':c};}catch(x){return{'ok':![],'layout':n,'target':h,'restored_files':d,'errors':['section\x20reset\x20failed:\x20'+x['message']]};}if(q){const y=o['replace'](/\.json$/,'');if(!PERSONA_ROLES['includes'](y))return{'ok':![],'layout':n,'target':h,'restored_files':[],'errors':['unknown\x20persona\x20role\x20\x27'+y+'\x27']};try{const z=readMergedPackIfPresent(k)??buildPristineMergedPack(i),A=z['personae']&&Array['isArray'](z['personae'])?[...z['personae']]:[],B=A['findIndex'](D=>D['role']===y),C=personaPerRole(y,i);if(B>=0x0)A[B]=C;else A['push'](C);return z['personae']=A,writeFileSync(join(k,'pack.json'),JSON['stringify'](z,null,0x2)+'\x0a'),d['push']('pack.json'),{'ok':!![],'layout':n,'target':h,'restored_files':d,'errors':c};}catch(D){return{'ok':![],'layout':n,'target':h,'restored_files':d,'errors':['persona\x20reset\x20failed:\x20'+D['message']]};}}if(j==='manifest.json'||j==='manifest')try{const E=readMergedPackIfPresent(k)??buildPristineMergedPack(i);return E['manifest']=manifestSection(i),writeFileSync(join(k,'pack.json'),JSON['stringify'](E,null,0x2)+'\x0a'),d['push']('pack.json'),{'ok':!![],'layout':n,'target':h,'restored_files':d,'errors':c};}catch(F){return{'ok':![],'layout':n,'target':h,'restored_files':d,'errors':['manifest\x20reset\x20failed:\x20'+F['message']]};}return{'ok':![],'layout':n,'target':h,'restored_files':[],'errors':['path\x20\x27'+j+'\x27\x20is\x20not\x20a\x20standard\x20section\x20file\x20of\x20pack\x20\x27'+i+'\x27.\x20Reset\x20is\x20only\x20provided\x20for\x20pack.json\x20standard\x20sections\x20and\x20playbook.md.']};}if(p)try{return writeFileSync(join(k,'playbook.md'),playbookTemplate(i)),d['push']('playbook.md'),{'ok':!![],'layout':n,'target':h,'restored_files':d,'errors':c};}catch(G){return{'ok':![],'layout':n,'target':h,'restored_files':d,'errors':['legacy\x20playbook\x20reset\x20failed:\x20'+G['message']]};}if(j==='manifest.json')try{const H=manifestSection(i);return writeFileSync(join(k,'manifest.json'),JSON['stringify'](H,null,0x2)+'\x0a'),d['push']('manifest.json'),{'ok':!![],'layout':n,'target':h,'restored_files':d,'errors':c};}catch(I){return{'ok':![],'layout':n,'target':h,'restored_files':d,'errors':['legacy\x20manifest\x20reset\x20failed:\x20'+I['message']]};}const r=LAYER_FILE_SECTION[j];if(r)try{let J='';switch(r){case'match':J=JSON['stringify'](matchSection(i),null,0x2)+'\x0a';break;case'dispute':J=JSON['stringify'](disputeSection(i),null,0x2)+'\x0a';break;case'compliance':J=JSON['stringify'](complianceSection(i),null,0x2)+'\x0a';break;case'supply':J=JSON['stringify'](supplySection(i),null,0x2)+'\x0a';break;case'rules':J=JSON['stringify'](rulesSection(i),null,0x2)+'\x0a';break;case'mode':J=JSON['stringify']({},null,0x2)+'\x0a';break;}return writeFileSync(join(k,j),J),d['push'](j),{'ok':!![],'layout':n,'target':h,'restored_files':d,'errors':c};}catch(K){return{'ok':![],'layout':n,'target':h,'restored_files':d,'errors':['legacy\x20section\x20reset\x20failed:\x20'+K['message']]};}if(q){const L=o['replace'](/\.json$/,'');if(!PERSONA_ROLES['includes'](L))return{'ok':![],'layout':n,'target':h,'restored_files':[],'errors':['unknown\x20persona\x20\x27'+L+'\x27']};try{return writeFileSync(join(k,j),JSON['stringify'](personaPerRole(L,i),null,0x2)+'\x0a'),d['push'](j),{'ok':!![],'layout':n,'target':h,'restored_files':d,'errors':c};}catch(M){return{'ok':![],'layout':n,'target':h,'restored_files':d,'errors':['legacy\x20persona\x20reset\x20failed:\x20'+M['message']]};}}return{'ok':![],'layout':n,'target':h,'restored_files':[],'errors':['cannot\x20reset\x20non-standard\x20file\x20\x27'+j+'\x27\x20in\x20legacy\x20layout.\x20Only\x20standard\x20layer\x20files,\x20personae/*.json,\x20manifest.json,\x20and\x20playbook.md\x20can\x20be\x20reset.']};}
|