@wowok/agent-mcp 2.7.0 → 2.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/index.js +1 -1
- package/dist/config/runtime.js +1 -238
- package/dist/customer/customer-advice.js +1 -130
- package/dist/customer/index.js +1 -11
- package/dist/customer/industry-risks.js +1 -438
- package/dist/customer/info-puzzle.js +1 -681
- package/dist/customer/order-monitor.js +1 -328
- package/dist/customer/order-strategy.js +1 -373
- package/dist/customer/post-purchase.js +1 -351
- package/dist/customer/preorder-compare.js +1 -34
- package/dist/customer/reminder-system.js +1 -316
- package/dist/customer/risk-assessment.d.ts +5 -1
- package/dist/customer/risk-assessment.js +1 -397
- package/dist/customer/types.js +1 -13
- package/dist/customer/user-preferences.js +1 -460
- package/dist/evaluation/arbitration-game.d.ts +23 -0
- package/dist/evaluation/arbitration-game.js +1 -0
- package/dist/evaluation/builtins/demand-match.d.ts +15 -0
- package/dist/evaluation/builtins/demand-match.js +1 -0
- package/dist/evaluation/builtins/index.d.ts +3 -0
- package/dist/evaluation/builtins/index.js +1 -0
- package/dist/evaluation/builtins/service-risk.d.ts +6 -0
- package/dist/evaluation/builtins/service-risk.js +1 -0
- package/dist/evaluation/capability.d.ts +50 -0
- package/dist/evaluation/capability.js +1 -0
- package/dist/evaluation/composer.d.ts +13 -0
- package/dist/evaluation/composer.js +1 -0
- package/dist/evaluation/engine.d.ts +18 -0
- package/dist/evaluation/engine.js +1 -0
- package/dist/evaluation/extract.d.ts +30 -0
- package/dist/evaluation/extract.js +1 -0
- package/dist/evaluation/game-strategy.d.ts +27 -0
- package/dist/evaluation/game-strategy.js +1 -0
- package/dist/evaluation/gap.d.ts +2 -0
- package/dist/evaluation/gap.js +1 -0
- package/dist/evaluation/index.d.ts +12 -0
- package/dist/evaluation/index.js +1 -0
- package/dist/evaluation/node-game.d.ts +62 -0
- package/dist/evaluation/node-game.js +1 -0
- package/dist/evaluation/region.d.ts +10 -0
- package/dist/evaluation/region.js +1 -0
- package/dist/evaluation/types.d.ts +77 -0
- package/dist/evaluation/types.js +1 -0
- package/dist/evaluation/user-injection.d.ts +6 -0
- package/dist/evaluation/user-injection.js +1 -0
- package/dist/examples/education-contact-create.json +40 -0
- package/dist/examples/freelance-contact-create.json +40 -0
- package/dist/examples/insurance-machine-create.json +1 -1
- package/dist/examples/insurance-service-allocators.json +1 -1
- package/dist/examples/machine-publish.json +1 -1
- package/dist/examples/rental-ziroom-service-create.json +1 -1
- package/dist/examples/retail-adv-guard-messenger-proof-create.json +1 -1
- package/dist/examples/retail-myshop-service-create.json +1 -1
- package/dist/examples/retail-myshop-service-customer-required.json +1 -1
- package/dist/examples/subscription-contact-create.json +40 -0
- package/dist/examples/threebody-machine-create.json +1 -1
- package/dist/examples/travel-machine-create.json +1 -1
- package/dist/examples/travel-service-create.json +1 -1
- package/dist/experience/experience-reuse.js +1 -103
- package/dist/experience/index.js +1 -5
- package/dist/experience/intent-distill.js +1 -83
- package/dist/experience/realtime-feedback.js +1 -94
- package/dist/experience/types.js +1 -1
- package/dist/experience/user-profile.js +1 -171
- package/dist/extensions/business-modules.js +1 -287
- package/dist/extensions/capability-manifest.js +1 -781
- package/dist/extensions/constraint-registry.js +1 -198
- package/dist/extensions/index.js +1 -6
- package/dist/extensions/metric-registry.js +1 -257
- package/dist/extensions/mode-evaluator.js +1 -170
- package/dist/extensions/modes.js +1 -499
- package/dist/extensions/registry.js +1 -717
- package/dist/extensions/types.js +1 -1
- package/dist/harness/auto-escalation.js +1 -68
- package/dist/harness/checkpoint.js +1 -129
- package/dist/harness/index.js +1 -78
- package/dist/harness/plan.js +1 -276
- package/dist/harness/recover.js +1 -139
- package/dist/harness/types.js +1 -1
- package/dist/harness/verify.js +1 -237
- package/dist/index.js +1 -273
- package/dist/intent/enrich.d.ts +1 -0
- package/dist/intent/enrich.js +1 -0
- package/dist/intent/index.d.ts +23 -0
- package/dist/intent/index.js +1 -0
- package/dist/intent/matcher.d.ts +2 -0
- package/dist/intent/matcher.js +1 -0
- package/dist/intent/store.d.ts +19 -0
- package/dist/intent/store.js +1 -0
- package/dist/intent/types.d.ts +33 -0
- package/dist/intent/types.js +1 -0
- package/dist/knowledge/acquisition-flywheel.js +1 -192
- package/dist/knowledge/allocation-confirm.js +1 -534
- package/dist/knowledge/allocation-context.js +1 -249
- package/dist/knowledge/allocation-ledger.js +1 -463
- package/dist/knowledge/allocation-puzzle.js +1 -298
- package/dist/knowledge/allocation-risk.js +1 -568
- package/dist/knowledge/allocation-templates.js +1 -970
- package/dist/knowledge/allocation-translation.js +1 -585
- package/dist/knowledge/arb-risk.js +1 -210
- package/dist/knowledge/arbitration-confirm.js +1 -559
- package/dist/knowledge/arbitration-context.js +1 -505
- package/dist/knowledge/arbitration-ledger.js +1 -521
- package/dist/knowledge/arbitration-puzzle.js +1 -304
- package/dist/knowledge/arbitration-risk.js +1 -433
- package/dist/knowledge/arbitration-templates.js +1 -276
- package/dist/knowledge/arbitration-translation.js +1 -487
- package/dist/knowledge/arbitration-trust.js +1 -117
- package/dist/knowledge/audit-rules.js +1 -141
- package/dist/knowledge/bridge-risk.js +1 -263
- package/dist/knowledge/contact-risk.js +1 -200
- package/dist/knowledge/contact-templates.d.ts +27 -0
- package/dist/knowledge/contact-templates.js +1 -0
- package/dist/knowledge/demand-confirm.js +1 -206
- package/dist/knowledge/demand-matching.js +1 -132
- package/dist/knowledge/demand-risk.js +1 -240
- package/dist/knowledge/demand-translation.js +1 -354
- package/dist/knowledge/deployment-scanner.js +1 -823
- package/dist/knowledge/dynamic-pricing.js +1 -87
- package/dist/knowledge/examples-scanner-cli.js +1 -26
- package/dist/knowledge/examples-scanner.js +1 -825
- package/dist/knowledge/flywheel-loop.js +1 -404
- package/dist/knowledge/fund-layer.js +1 -973
- package/dist/knowledge/glossary.js +1 -211
- package/dist/knowledge/guard-confirm.js +1 -406
- package/dist/knowledge/guard-context.js +1 -287
- package/dist/knowledge/guard-design-patterns.js +1 -360
- package/dist/knowledge/guard-ledger.js +1 -260
- package/dist/knowledge/guard-lint.js +1 -670
- package/dist/knowledge/guard-migration.js +1 -228
- package/dist/knowledge/guard-puzzle.js +1 -805
- package/dist/knowledge/guard-render.js +1 -700
- package/dist/knowledge/guard-risk.js +1 -1879
- package/dist/knowledge/guard-submission-prompt.js +1 -171
- package/dist/knowledge/guard-templates.js +1 -1105
- package/dist/knowledge/guard-translation.js +1 -1119
- package/dist/knowledge/index.js +1 -436
- package/dist/knowledge/industry-evolution.js +1 -323
- package/dist/knowledge/industry-generalizer.js +1 -381
- package/dist/knowledge/industry-registry.js +1 -174
- package/dist/knowledge/intent-metrics.d.ts +4 -3
- package/dist/knowledge/intent-metrics.js +1 -566
- package/dist/knowledge/machine-confirm.js +1 -559
- package/dist/knowledge/machine-context.js +1 -833
- package/dist/knowledge/machine-ledger.js +1 -338
- package/dist/knowledge/machine-puzzle.js +1 -494
- package/dist/knowledge/machine-render.js +1 -565
- package/dist/knowledge/machine-risk.js +1 -670
- package/dist/knowledge/machine-templates.js +1 -1597
- package/dist/knowledge/machine-topology.js +1 -234
- package/dist/knowledge/machine-translation.js +1 -513
- package/dist/knowledge/mcp-schema-audit-cli.js +1 -45
- package/dist/knowledge/mcp-schema-audit.d.ts +1 -1
- package/dist/knowledge/mcp-schema-audit.js +1 -773
- package/dist/knowledge/onchain-constants.js +1 -35
- package/dist/knowledge/order-confirm.js +1 -573
- package/dist/knowledge/order-context.js +1 -390
- package/dist/knowledge/order-ledger.js +1 -341
- package/dist/knowledge/order-puzzle.js +1 -255
- package/dist/knowledge/order-risk.js +1 -653
- package/dist/knowledge/order-templates.js +1 -368
- package/dist/knowledge/order-translation.js +1 -550
- package/dist/knowledge/overrides-loader.js +1 -65
- package/dist/knowledge/passport-confirm.js +1 -531
- package/dist/knowledge/passport-context.js +1 -306
- package/dist/knowledge/passport-ledger.js +1 -282
- package/dist/knowledge/passport-puzzle.js +1 -333
- package/dist/knowledge/passport-risk.js +1 -450
- package/dist/knowledge/passport-templates.js +1 -568
- package/dist/knowledge/passport-translation.js +1 -516
- package/dist/knowledge/payment-risk.js +1 -249
- package/dist/knowledge/permission-confirm.js +1 -426
- package/dist/knowledge/permission-context.js +1 -224
- package/dist/knowledge/permission-ledger.js +1 -403
- package/dist/knowledge/permission-puzzle.js +1 -173
- package/dist/knowledge/permission-risk.js +1 -411
- package/dist/knowledge/permission-templates.js +1 -234
- package/dist/knowledge/permission-translation.js +1 -350
- package/dist/knowledge/personal-risk.js +1 -212
- package/dist/knowledge/process-model.js +1 -160
- package/dist/knowledge/progress-confirm.js +1 -456
- package/dist/knowledge/progress-context.js +1 -452
- package/dist/knowledge/progress-ledger.js +1 -330
- package/dist/knowledge/progress-puzzle.js +1 -219
- package/dist/knowledge/progress-risk.js +1 -461
- package/dist/knowledge/progress-templates.js +1 -228
- package/dist/knowledge/progress-translation.js +1 -405
- package/dist/knowledge/proof-confirm.js +1 -187
- package/dist/knowledge/proof-risk.js +1 -207
- package/dist/knowledge/proof-translation.js +1 -283
- package/dist/knowledge/registrar-risk.js +1 -217
- package/dist/knowledge/repository-confirm.js +1 -286
- package/dist/knowledge/repository-risk.js +1 -373
- package/dist/knowledge/repository-translation.js +1 -445
- package/dist/knowledge/reputation-rules.js +1 -99
- package/dist/knowledge/resource-risk.js +1 -157
- package/dist/knowledge/reward-confirm.js +1 -526
- package/dist/knowledge/reward-context.js +1 -504
- package/dist/knowledge/reward-ledger.js +1 -502
- package/dist/knowledge/reward-puzzle.js +1 -300
- package/dist/knowledge/reward-risk.js +1 -627
- package/dist/knowledge/reward-templates.js +1 -197
- package/dist/knowledge/reward-translation.js +1 -501
- package/dist/knowledge/safety-rules.js +1 -404
- package/dist/knowledge/scenario-modes.js +1 -321
- package/dist/knowledge/service-confirm.js +1 -807
- package/dist/knowledge/service-context.js +1 -403
- package/dist/knowledge/service-ledger.js +1 -609
- package/dist/knowledge/service-puzzle.js +1 -236
- package/dist/knowledge/service-risk.js +1 -615
- package/dist/knowledge/service-templates.js +1 -456
- package/dist/knowledge/service-translation.js +1 -622
- package/dist/knowledge/template-registry.d.ts +1 -1
- package/dist/knowledge/template-registry.js +1 -341
- package/dist/knowledge/tool-constraints.js +1 -195
- package/dist/knowledge/tools-reference.js +1 -155
- package/dist/knowledge/treasury-confirm.js +1 -512
- package/dist/knowledge/treasury-context.js +1 -363
- package/dist/knowledge/treasury-ledger.js +1 -300
- package/dist/knowledge/treasury-puzzle.js +1 -216
- package/dist/knowledge/treasury-risk.js +1 -440
- package/dist/knowledge/treasury-templates.js +1 -358
- package/dist/knowledge/treasury-translation.js +1 -498
- package/dist/knowledge/trust-metrics.js +1 -198
- package/dist/knowledge/util-risk.js +1 -135
- package/dist/loop-engineering/aggregate.js +1 -132
- package/dist/loop-engineering/context-collect.js +1 -83
- package/dist/loop-engineering/diagnose.js +1 -273
- package/dist/loop-engineering/improve.js +1 -405
- package/dist/loop-engineering/index.js +1 -4
- package/dist/loop-engineering/pipeline.js +1 -56
- package/dist/mode-market/index.js +1 -3
- package/dist/mode-market/registry.js +1 -124
- package/dist/mode-market/review.js +1 -214
- package/dist/mode-market/submission.js +1 -85
- package/dist/participation/collaborator-interest.d.ts +23 -0
- package/dist/participation/collaborator-interest.js +1 -0
- package/dist/participation/customer-interest.d.ts +25 -0
- package/dist/participation/customer-interest.js +1 -0
- package/dist/participation/merchant-interest.js +1 -100
- package/dist/participation/radar-core.d.ts +13 -3
- package/dist/participation/radar-core.js +1 -269
- package/dist/participation/supplier-interest.d.ts +25 -0
- package/dist/participation/supplier-interest.js +1 -0
- package/dist/persona/analyzer.d.ts +16 -0
- package/dist/persona/analyzer.js +1 -0
- package/dist/persona/bridge.d.ts +5 -0
- package/dist/persona/bridge.js +1 -0
- package/dist/persona/defaults.d.ts +4 -0
- package/dist/persona/defaults.js +1 -0
- package/dist/persona/experience-bridge.d.ts +3 -0
- package/dist/persona/experience-bridge.js +1 -0
- package/dist/persona/index.d.ts +18 -0
- package/dist/persona/index.js +1 -0
- package/dist/persona/model.d.ts +7 -0
- package/dist/persona/model.js +1 -0
- package/dist/persona/store.d.ts +19 -0
- package/dist/persona/store.js +1 -0
- package/dist/persona/types.d.ts +45 -0
- package/dist/persona/types.js +1 -0
- package/dist/project/business-puzzle.js +1 -383
- package/dist/project/context-assembly.js +1 -254
- package/dist/project/deployment-bridge.js +1 -120
- package/dist/project/deployment-doc.js +1 -1126
- package/dist/project/edit-planner.js +1 -1342
- package/dist/project/evaluation.js +1 -2011
- package/dist/project/game-theory.js +1 -177
- package/dist/project/graph-builder.js +1 -656
- package/dist/project/graph.js +1 -340
- package/dist/project/handlers.d.ts +5 -0
- package/dist/project/handlers.js +1 -1762
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +1 -301
- package/dist/project/intent-analyzer.js +1 -149
- package/dist/project/machine-nodes.js +1 -36
- package/dist/project/merchant-guide.js +1 -264
- package/dist/project/migration.js +1 -125
- package/dist/project/mode-actions.js +1 -309
- package/dist/project/namespace.js +1 -206
- package/dist/project/participation-radar.js +1 -428
- package/dist/project/pipeline-actions.js +1 -109
- package/dist/project/project-store.js +1 -422
- package/dist/project/query.js +1 -153
- package/dist/project/reverse-mapping.d.ts +34 -0
- package/dist/project/reverse-mapping.js +1 -0
- package/dist/project/risk-aggregator.js +1 -295
- package/dist/project/rollback-policy.js +1 -290
- package/dist/project/semantic-assembler.js +1 -345
- package/dist/project/semantic-graph.js +1 -245
- package/dist/project/stage-gate.js +1 -369
- package/dist/project/substep-trace.js +1 -332
- package/dist/project/task-tracker.js +1 -78
- package/dist/role/derivation.d.ts +18 -0
- package/dist/role/derivation.js +1 -0
- package/dist/role/index.d.ts +5 -0
- package/dist/role/index.js +1 -0
- package/dist/role/model.d.ts +8 -0
- package/dist/role/model.js +1 -0
- package/dist/role/resolution.d.ts +11 -0
- package/dist/role/resolution.js +1 -0
- package/dist/role/types.d.ts +11 -0
- package/dist/role/types.js +1 -0
- package/dist/rules.d.ts +2 -0
- package/dist/rules.js +1 -9
- package/dist/safety/confirm-gate.js +1 -88
- package/dist/safety/index.js +1 -3
- package/dist/safety/preview.js +1 -52
- package/dist/schema/call/allocation.js +1 -34
- package/dist/schema/call/arbitration.js +1 -113
- package/dist/schema/call/base.d.ts +15 -15
- package/dist/schema/call/base.js +1 -370
- package/dist/schema/call/bridge-handler.js +1 -265
- package/dist/schema/call/bridge.d.ts +7 -7
- package/dist/schema/call/bridge.js +1 -458
- package/dist/schema/call/contact.js +1 -37
- package/dist/schema/call/demand.js +1 -47
- package/dist/schema/call/guard.js +1 -161
- package/dist/schema/call/handler.js +1 -322
- package/dist/schema/call/index.js +1 -20
- package/dist/schema/call/machine.js +1 -193
- package/dist/schema/call/order.js +1 -35
- package/dist/schema/call/payment.js +1 -37
- package/dist/schema/call/permission-handler.js +1 -54
- package/dist/schema/call/permission.js +1 -105
- package/dist/schema/call/personal.js +1 -78
- package/dist/schema/call/progress.js +1 -47
- package/dist/schema/call/proof.js +1 -33
- package/dist/schema/call/repository.js +1 -77
- package/dist/schema/call/reward.js +1 -30
- package/dist/schema/call/semantic.js +1 -1657
- package/dist/schema/call/service.js +1 -178
- package/dist/schema/call/treasury.js +1 -71
- package/dist/schema/common/index.js +1 -407
- package/dist/schema/config/index.js +1 -68
- package/dist/schema/evaluation/index.d.ts +4436 -0
- package/dist/schema/evaluation/index.js +1 -0
- package/dist/schema/index.d.ts +4 -0
- package/dist/schema/index.js +1 -13
- package/dist/schema/intent-radar/index.d.ts +284 -0
- package/dist/schema/intent-radar/index.js +1 -0
- package/dist/schema/local/index.d.ts +21 -21
- package/dist/schema/local/index.js +1 -927
- package/dist/schema/local/wip.js +1 -187
- package/dist/schema/messenger/index.d.ts +7 -7
- package/dist/schema/messenger/index.js +1 -475
- package/dist/schema/operations.d.ts +7 -7
- package/dist/schema/operations.js +1 -520
- package/dist/schema/persona/index.d.ts +1985 -0
- package/dist/schema/persona/index.js +1 -0
- package/dist/schema/project/index.d.ts +96 -50
- package/dist/schema/project/index.js +1 -2057
- package/dist/schema/query/index.d.ts +423 -7
- package/dist/schema/query/index.js +1 -1640
- package/dist/schema/schema-query/index.js +1 -104
- package/dist/schema/schema-version.js +1 -76
- package/dist/schema/sync-layer4.d.ts +1 -1
- package/dist/schema/sync-layer4.js +1 -282
- package/dist/schema/task-status.d.ts +168 -0
- package/dist/schema/task-status.js +1 -0
- package/dist/schema/trust/index.js +1 -314
- package/dist/schema/utils/guard-parser.js +1 -419
- package/dist/schema/utils/guard-query-utils.js +1 -46
- package/dist/schema/utils/node-parser.js +1 -369
- package/dist/schema/utils/object-type-utils.js +1 -35
- package/dist/schema/utils/permission-index-utils.js +1 -7
- package/dist/schema/utils/permission-machine-check.js +1 -121
- package/dist/schema/utils/skills-recommendation.js +1 -77
- package/dist/schema-query/index.js +1 -810
- package/dist/schemas/account_operation.output.json +5 -2
- package/dist/schemas/bridge_operation.output.json +5 -2
- package/dist/schemas/evaluation_operation.output.json +782 -0
- package/dist/schemas/evaluation_operation.schema.json +990 -0
- package/dist/schemas/index.json +25 -1
- package/dist/schemas/intent_radar.output.json +232 -0
- package/dist/schemas/intent_radar.schema.json +138 -0
- package/dist/schemas/local_info_operation.output.json +5 -2
- package/dist/schemas/local_mark_operation.output.json +5 -2
- package/dist/schemas/messenger_operation.output.json +5 -2
- package/dist/schemas/onchain_events.output.json +5 -2
- package/dist/schemas/onchain_operations.output.json +5 -2
- package/dist/schemas/onchain_operations.schema.json +6 -6
- package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +2 -2
- package/dist/schemas/onchain_operations_service.schema.json +3 -3
- package/dist/schemas/onchain_table_data.output.json +6 -3
- package/dist/schemas/persona_operation.output.json +392 -0
- package/dist/schemas/persona_operation.schema.json +250 -0
- package/dist/schemas/project_operation.output.json +28 -8
- package/dist/schemas/query_task_status.output.json +115 -0
- package/dist/schemas/query_task_status.schema.json +24 -0
- package/dist/schemas/query_toolkit.output.json +9 -6
- package/dist/schemas/trust_score.schema.json +1 -1
- package/dist/schemas/wowok_buildin_info.output.json +132 -0
- package/dist/schemas/wowok_buildin_info.schema.json +14 -0
- package/dist/telemetry/index.js +1 -112
- package/dist/telemetry/redact.js +1 -23
- package/dist/telemetry/storage.js +1 -80
- package/dist/tools/handlers/bridge.js +1 -1
- package/dist/tools/handlers/config.js +1 -74
- package/dist/tools/handlers/evaluation.d.ts +2 -0
- package/dist/tools/handlers/evaluation.js +1 -0
- package/dist/tools/handlers/file-export.js +1 -90
- package/dist/tools/handlers/intent-radar.d.ts +2 -0
- package/dist/tools/handlers/intent-radar.js +1 -0
- package/dist/tools/handlers/local.js +1 -53
- package/dist/tools/handlers/messenger.js +1 -188
- package/dist/tools/handlers/onchain.js +1 -1082
- package/dist/tools/handlers/persona.d.ts +4 -0
- package/dist/tools/handlers/persona.js +1 -0
- package/dist/tools/handlers/project.js +1 -211
- package/dist/tools/handlers/query.js +1 -434
- package/dist/tools/handlers/schema-query.js +1 -176
- package/dist/tools/handlers/task-status.d.ts +0 -168
- package/dist/tools/handlers/task-status.js +1 -55
- package/dist/tools/handlers/trust.js +1 -380
- package/dist/tools/handlers/wip.js +1 -90
- package/dist/tools/index.js +1 -1306
- package/dist/tools/retry.js +1 -85
- package/dist/tools/rules-hook.js +1 -23
- package/dist/tools/shared.js +1 -130
- package/dist/tools/types.js +1 -1
- package/dist/tools/upgrade-check.d.ts +19 -0
- package/dist/tools/upgrade-check.js +1 -0
- package/dist/tools/wip-deploy-assist.d.ts +1 -1
- package/dist/tools/wip-deploy-assist.js +1 -278
- package/dist/tools/wrap.js +1 -500
- package/package.json +5 -3
|
@@ -1,505 +1 @@
|
|
|
1
|
-
import { MAX_VOTING_GUARD_COUNT, } from "@wowok/wowok";
|
|
2
|
-
import { ARBITRATION_SCENES, DUAL_GUARD_MATRIX, ARB_STATUS_CODE, ARB_TERMINAL_STATUSES, findSceneByPermissionIndex, inferSceneFromIntent, getScenesByCategory, getDualGuardMatrixEntry, isValidArbStatusTransition, isTerminalArbStatus, getActiveArbitrationPermissions, getAllArbitrationPermissions, } from "./arbitration-ledger.js";
|
|
3
|
-
import { getTemplatesByScene, } from "./arbitration-templates.js";
|
|
4
|
-
import { ARBITRATION_CONSTRAINT_RULES, matchSemanticPattern, } from "./arbitration-translation.js";
|
|
5
|
-
import { getAllRiskRules, assessArbitrationRisks, } from "./arbitration-risk.js";
|
|
6
|
-
import { initPuzzleFromIntent, checkPuzzleCompleteness, } from "./arbitration-puzzle.js";
|
|
7
|
-
import { ARBITRATION_OPERATION_CHECKLIST, ARBITRATION_CONFIRMATION_QUESTIONS, } from "./arbitration-confirm.js";
|
|
8
|
-
export const ARBITRATION_CONTEXT_VERSION = "1.0.0";
|
|
9
|
-
export function buildArbitrationContext(input) {
|
|
10
|
-
const max_length = input.max_length ?? 4500;
|
|
11
|
-
let matched_scene;
|
|
12
|
-
if (input.intent) {
|
|
13
|
-
matched_scene = inferSceneFromIntent(input.intent);
|
|
14
|
-
}
|
|
15
|
-
else if (input.target_permission_index !== undefined) {
|
|
16
|
-
matched_scene = findSceneByPermissionIndex(input.target_permission_index);
|
|
17
|
-
}
|
|
18
|
-
else if (input.target_operation_category) {
|
|
19
|
-
const scenes = getScenesByCategory(input.target_operation_category);
|
|
20
|
-
if (scenes.length > 0)
|
|
21
|
-
matched_scene = scenes[0];
|
|
22
|
-
}
|
|
23
|
-
let matched_template;
|
|
24
|
-
if (matched_scene) {
|
|
25
|
-
const templates = getTemplatesByScene(matched_scene.id);
|
|
26
|
-
if (templates.length > 0)
|
|
27
|
-
matched_template = templates[0];
|
|
28
|
-
}
|
|
29
|
-
let matched_pattern;
|
|
30
|
-
if (input.intent) {
|
|
31
|
-
const patterns = matchSemanticPattern(input.intent);
|
|
32
|
-
if (patterns.length > 0)
|
|
33
|
-
matched_pattern = patterns[0];
|
|
34
|
-
}
|
|
35
|
-
let puzzle_state;
|
|
36
|
-
let puzzle_completeness;
|
|
37
|
-
if (input.mode === "initial_design" && input.intent) {
|
|
38
|
-
puzzle_state = initPuzzleFromIntent({ rule_sentence: input.intent });
|
|
39
|
-
puzzle_completeness = checkPuzzleCompleteness(puzzle_state);
|
|
40
|
-
}
|
|
41
|
-
const relevant_risks = filterRiskRules(input.mode, input.stakeholder, matched_scene);
|
|
42
|
-
let risk_assessment;
|
|
43
|
-
if (input.mode === "pre_publish" && input.arbitration_json) {
|
|
44
|
-
const ctx = {
|
|
45
|
-
object: input.arbitration_json.object,
|
|
46
|
-
description: input.arbitration_json.description,
|
|
47
|
-
location: input.arbitration_json.location,
|
|
48
|
-
fee: input.arbitration_json.fee,
|
|
49
|
-
pause: input.arbitration_json.pause,
|
|
50
|
-
dispute: input.arbitration_json.dispute,
|
|
51
|
-
confirm: input.arbitration_json.confirm,
|
|
52
|
-
voting_deadline_change: input.arbitration_json.voting_deadline_change,
|
|
53
|
-
vote: input.arbitration_json.vote,
|
|
54
|
-
feedback: input.arbitration_json.feedback,
|
|
55
|
-
arbitration: input.arbitration_json.arbitration,
|
|
56
|
-
reset: input.arbitration_json.reset,
|
|
57
|
-
arb_withdraw: input.arbitration_json.arb_withdraw,
|
|
58
|
-
fees_transfer: input.arbitration_json.fees_transfer,
|
|
59
|
-
usage_guard: input.arbitration_json.usage_guard,
|
|
60
|
-
voting_guard: input.arbitration_json.voting_guard,
|
|
61
|
-
um: input.arbitration_json.um,
|
|
62
|
-
builder: input.arbitration_json.builder,
|
|
63
|
-
current_arb_status: input.current_arb_status,
|
|
64
|
-
expected_arb_status: input.arbitration_json.arbitration ? "Arbitrated" : input.current_arb_status,
|
|
65
|
-
};
|
|
66
|
-
risk_assessment = assessArbitrationRisks(ctx);
|
|
67
|
-
}
|
|
68
|
-
const relevant_checklist = filterChecklist(input.mode);
|
|
69
|
-
const relevant_questions = filterQuestions(input.mode);
|
|
70
|
-
const relevant_constraints = filterConstraints(input.mode, matched_scene);
|
|
71
|
-
const relevant_permissions = input.stakeholder === "system"
|
|
72
|
-
? getAllArbitrationPermissions()
|
|
73
|
-
: getActiveArbitrationPermissions();
|
|
74
|
-
let dual_guard_matrix_entry;
|
|
75
|
-
if (input.voting_guard_empty !== undefined && input.usage_guard_none !== undefined) {
|
|
76
|
-
dual_guard_matrix_entry = getDualGuardMatrixEntry(input.voting_guard_empty, input.usage_guard_none);
|
|
77
|
-
}
|
|
78
|
-
else if (matched_scene) {
|
|
79
|
-
const vEmpty = matched_scene.requires_voting_guard === "empty";
|
|
80
|
-
const uNone = matched_scene.requires_usage_guard === "none";
|
|
81
|
-
dual_guard_matrix_entry = getDualGuardMatrixEntry(vEmpty, uNone);
|
|
82
|
-
}
|
|
83
|
-
const arb_lifecycle_context = buildArbLifecycleContext(input.current_arb_status, matched_scene);
|
|
84
|
-
const cross_object_refs = buildCrossObjectRefs(matched_scene);
|
|
85
|
-
const onchain_constraints = buildOnchainConstraints();
|
|
86
|
-
const rendering_hints = buildRenderingHints(input.mode, max_length, !!input.arbitration_json?.arbitration, !!input.arbitration_json?.builder);
|
|
87
|
-
return {
|
|
88
|
-
version: ARBITRATION_CONTEXT_VERSION,
|
|
89
|
-
mode: input.mode,
|
|
90
|
-
stakeholder_perspective: input.stakeholder,
|
|
91
|
-
matched_scene,
|
|
92
|
-
matched_template,
|
|
93
|
-
matched_pattern,
|
|
94
|
-
puzzle_state,
|
|
95
|
-
puzzle_completeness,
|
|
96
|
-
relevant_risks,
|
|
97
|
-
risk_assessment,
|
|
98
|
-
relevant_checklist,
|
|
99
|
-
relevant_questions,
|
|
100
|
-
relevant_permissions,
|
|
101
|
-
relevant_constraints,
|
|
102
|
-
dual_guard_matrix_entry,
|
|
103
|
-
arb_lifecycle_context,
|
|
104
|
-
cross_object_refs,
|
|
105
|
-
onchain_constraints,
|
|
106
|
-
rendering_hints,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
function filterRiskRules(mode, stakeholder, scene) {
|
|
110
|
-
const rules = getAllRiskRules();
|
|
111
|
-
if (mode === "initial_design") {
|
|
112
|
-
return rules.filter(r => r.category === "structural" || r.category === "authority");
|
|
113
|
-
}
|
|
114
|
-
if (mode === "pre_publish") {
|
|
115
|
-
return rules;
|
|
116
|
-
}
|
|
117
|
-
if (mode === "stakeholder_review" && stakeholder) {
|
|
118
|
-
if (stakeholder === "owner") {
|
|
119
|
-
return rules.filter(r => r.category === "authority" || r.category === "lifecycle" || r.category === "cross_object");
|
|
120
|
-
}
|
|
121
|
-
if (stakeholder === "arbiter") {
|
|
122
|
-
return rules.filter(r => r.category === "authority" || r.category === "lifecycle");
|
|
123
|
-
}
|
|
124
|
-
if (stakeholder === "voter") {
|
|
125
|
-
return rules.filter(r => r.category === "structural" || r.category === "lifecycle");
|
|
126
|
-
}
|
|
127
|
-
if (stakeholder === "disputant") {
|
|
128
|
-
return rules.filter(r => r.category === "semantic" || r.category === "lifecycle");
|
|
129
|
-
}
|
|
130
|
-
if (stakeholder === "system") {
|
|
131
|
-
return rules.filter(r => r.category === "structural" || r.category === "cross_object");
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (mode === "post_publish_modify") {
|
|
135
|
-
return rules.filter(r => r.category === "lifecycle" || r.category === "cross_object");
|
|
136
|
-
}
|
|
137
|
-
return rules;
|
|
138
|
-
}
|
|
139
|
-
function filterChecklist(mode) {
|
|
140
|
-
if (mode === "initial_design") {
|
|
141
|
-
return ARBITRATION_OPERATION_CHECKLIST.filter(i => ["C-AB-01", "C-AB-02", "C-AB-03", "C-AB-04"].includes(i.id));
|
|
142
|
-
}
|
|
143
|
-
return [...ARBITRATION_OPERATION_CHECKLIST];
|
|
144
|
-
}
|
|
145
|
-
function filterQuestions(mode) {
|
|
146
|
-
if (mode === "pre_publish") {
|
|
147
|
-
return [...ARBITRATION_CONFIRMATION_QUESTIONS];
|
|
148
|
-
}
|
|
149
|
-
if (mode === "post_publish_modify") {
|
|
150
|
-
return ARBITRATION_CONFIRMATION_QUESTIONS.filter(q => q.id !== "QAB5");
|
|
151
|
-
}
|
|
152
|
-
return [];
|
|
153
|
-
}
|
|
154
|
-
function filterConstraints(mode, scene) {
|
|
155
|
-
if (mode === "initial_design") {
|
|
156
|
-
return ARBITRATION_CONSTRAINT_RULES.filter(c => c.category === "structural");
|
|
157
|
-
}
|
|
158
|
-
if (mode === "pre_publish") {
|
|
159
|
-
return [...ARBITRATION_CONSTRAINT_RULES];
|
|
160
|
-
}
|
|
161
|
-
if (scene) {
|
|
162
|
-
const categoryMap = {
|
|
163
|
-
lifecycle: ["structural", "authority"],
|
|
164
|
-
dispute: ["semantic", "lifecycle"],
|
|
165
|
-
voting: ["semantic", "lifecycle"],
|
|
166
|
-
ruling: ["authority", "lifecycle"],
|
|
167
|
-
fund: ["cross_object"],
|
|
168
|
-
guard: ["structural", "semantic"],
|
|
169
|
-
governance: ["authority"],
|
|
170
|
-
};
|
|
171
|
-
const cats = categoryMap[scene.operation_category] ?? [];
|
|
172
|
-
return ARBITRATION_CONSTRAINT_RULES.filter(c => cats.includes(c.category));
|
|
173
|
-
}
|
|
174
|
-
return [...ARBITRATION_CONSTRAINT_RULES];
|
|
175
|
-
}
|
|
176
|
-
function buildArbLifecycleContext(current_status, scene) {
|
|
177
|
-
if (!current_status && !scene)
|
|
178
|
-
return undefined;
|
|
179
|
-
const is_terminal = current_status ? isTerminalArbStatus(current_status) : false;
|
|
180
|
-
const valid_next_statuses = [];
|
|
181
|
-
if (current_status) {
|
|
182
|
-
const allStatuses = [
|
|
183
|
-
"Principal_confirming",
|
|
184
|
-
"Arbitrator_confirming",
|
|
185
|
-
"Voting",
|
|
186
|
-
"Arbitrated",
|
|
187
|
-
"Objectionable",
|
|
188
|
-
"Finished",
|
|
189
|
-
"Withdrawn",
|
|
190
|
-
];
|
|
191
|
-
for (const target of allStatuses) {
|
|
192
|
-
if (target !== current_status && isValidArbStatusTransition(current_status, target)) {
|
|
193
|
-
valid_next_statuses.push(target);
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
const valid_operations_from_here = [];
|
|
198
|
-
for (const s of ARBITRATION_SCENES) {
|
|
199
|
-
if (current_status && s.required_arb_status && s.required_arb_status.includes(current_status)) {
|
|
200
|
-
valid_operations_from_here.push(s.id);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return {
|
|
204
|
-
current_status,
|
|
205
|
-
current_status_code: current_status ? ARB_STATUS_CODE[current_status] : undefined,
|
|
206
|
-
is_terminal,
|
|
207
|
-
valid_next_statuses,
|
|
208
|
-
valid_operations_from_here,
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
function buildCrossObjectRefs(scene) {
|
|
212
|
-
const refs = [];
|
|
213
|
-
const outboundRefs = [
|
|
214
|
-
{
|
|
215
|
-
object: "Order",
|
|
216
|
-
field: "dispute.order",
|
|
217
|
-
scene_id: "arbitration_dispute",
|
|
218
|
-
description: "dispute() takes Order address — Order is the source of disputes",
|
|
219
|
-
direction: "references",
|
|
220
|
-
},
|
|
221
|
-
{
|
|
222
|
-
object: "Arb",
|
|
223
|
-
field: "dispute (spawns Arb)",
|
|
224
|
-
scene_id: "arbitration_dispute",
|
|
225
|
-
description: "Each dispute() creates a new Arb case object with 7-state lifecycle",
|
|
226
|
-
direction: "references",
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
object: "Guard",
|
|
230
|
-
field: "voting_guard / usage_guard",
|
|
231
|
-
scene_id: "arbitration_voting_guard_config / arbitration_usage_guard_config",
|
|
232
|
-
description: "voting_guard controls vote weight (max 50); usage_guard filters who can file disputes",
|
|
233
|
-
direction: "references",
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
object: "Allocation",
|
|
237
|
-
field: "fees_transfer.to.allocation",
|
|
238
|
-
scene_id: "arbitration_fees_transfer",
|
|
239
|
-
description: "Withdrawn fees can be routed to Allocation for arbiter compensation distribution",
|
|
240
|
-
direction: "references",
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
object: "Treasury",
|
|
244
|
-
field: "fees_transfer.to.treasury",
|
|
245
|
-
scene_id: "arbitration_fees_transfer",
|
|
246
|
-
description: "Withdrawn fees can be routed to Treasury as alternative destination",
|
|
247
|
-
direction: "references",
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
object: "Contact",
|
|
251
|
-
field: "um",
|
|
252
|
-
scene_id: "arbitration_um_set",
|
|
253
|
-
description: "um (Contact object) for arbitrator ↔ disputant communication channel",
|
|
254
|
-
direction: "references",
|
|
255
|
-
},
|
|
256
|
-
{
|
|
257
|
-
object: "Payment",
|
|
258
|
-
field: "fees_transfer.payment_remark / payment_index",
|
|
259
|
-
scene_id: "arbitration_fees_transfer",
|
|
260
|
-
description: "fees_transfer creates Payment object with remark + index for audit trail",
|
|
261
|
-
direction: "references",
|
|
262
|
-
},
|
|
263
|
-
];
|
|
264
|
-
const inboundRefs = [
|
|
265
|
-
{
|
|
266
|
-
object: "Service",
|
|
267
|
-
field: "arbitrations (MAX_ARBITRATION_COUNT=20)",
|
|
268
|
-
scene_id: "service_arbitration_config",
|
|
269
|
-
description: "Service embeds up to 20 Arbitration references for dispute resolution per service",
|
|
270
|
-
direction: "referenced_by",
|
|
271
|
-
},
|
|
272
|
-
];
|
|
273
|
-
if (scene) {
|
|
274
|
-
const sceneId = scene.id;
|
|
275
|
-
return [...outboundRefs, ...inboundRefs].filter(r => r.scene_id === sceneId || r.scene_id.includes(sceneId.split("_")[1] ?? ""));
|
|
276
|
-
}
|
|
277
|
-
return [...outboundRefs, ...inboundRefs];
|
|
278
|
-
}
|
|
279
|
-
function buildOnchainConstraints() {
|
|
280
|
-
return [
|
|
281
|
-
{
|
|
282
|
-
name: "MAX_VOTING_GUARD_COUNT",
|
|
283
|
-
value: MAX_VOTING_GUARD_COUNT,
|
|
284
|
-
description: "Maximum voting_guard entries per Arbitration (Move source: arbitration.move:25)",
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
name: "ARBITRATION_PERMISSION_INDEX_RANGE",
|
|
288
|
-
value: "350-368 (352 reserved)",
|
|
289
|
-
description: "19 built-in permission indexes for Arbitration — most among all 22 objects",
|
|
290
|
-
},
|
|
291
|
-
{
|
|
292
|
-
name: "ARB_STATE_COUNT",
|
|
293
|
-
value: 7,
|
|
294
|
-
description: "Arb has 7-state lifecycle: Principal_confirming → Arbitrator_confirming → Voting → Arbitrated → Objectionable → Finished/Withdrawn",
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
name: "ARB_TERMINAL_STATUSES",
|
|
298
|
-
value: ARB_TERMINAL_STATUSES.length,
|
|
299
|
-
description: `Terminal statuses: ${ARB_TERMINAL_STATUSES.join(", ")} (no further transitions)`,
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
name: "DUAL_GUARD_COMBINATIONS",
|
|
303
|
-
value: DUAL_GUARD_MATRIX.length,
|
|
304
|
-
description: "4 dual-Guard combos: (voting_guard empty/non-empty) × (usage_guard none/some)",
|
|
305
|
-
},
|
|
306
|
-
];
|
|
307
|
-
}
|
|
308
|
-
function buildRenderingHints(mode, max_length, hasIndemnity, hasOwnershipTransfer) {
|
|
309
|
-
return {
|
|
310
|
-
include_puzzle_template: mode === "initial_design",
|
|
311
|
-
include_risk_details: mode === "pre_publish" || mode === "stakeholder_review",
|
|
312
|
-
include_questions: mode === "pre_publish",
|
|
313
|
-
include_dual_guard_matrix: mode === "initial_design" || mode === "pre_publish",
|
|
314
|
-
include_arb_lifecycle: mode === "pre_publish" || mode === "post_publish_modify" || mode === "stakeholder_review",
|
|
315
|
-
include_immutability_warning: mode === "post_publish_modify",
|
|
316
|
-
include_indemnity_warning: hasIndemnity,
|
|
317
|
-
include_ownership_transfer_warning: hasOwnershipTransfer,
|
|
318
|
-
max_length,
|
|
319
|
-
};
|
|
320
|
-
}
|
|
321
|
-
export function buildPromptFromArbitrationContext(bundle) {
|
|
322
|
-
const lines = [];
|
|
323
|
-
const h = bundle.rendering_hints;
|
|
324
|
-
lines.push(`═══ Arbitration Context (mode: ${bundle.mode}) ═══`);
|
|
325
|
-
lines.push("");
|
|
326
|
-
if (bundle.stakeholder_perspective) {
|
|
327
|
-
lines.push(`Stakeholder perspective: ${bundle.stakeholder_perspective}`);
|
|
328
|
-
lines.push("");
|
|
329
|
-
}
|
|
330
|
-
if (bundle.matched_scene) {
|
|
331
|
-
lines.push(`Scene: ${bundle.matched_scene.name}`);
|
|
332
|
-
lines.push(`Category: ${bundle.matched_scene.operation_category}`);
|
|
333
|
-
lines.push(`Permission index: ${bundle.matched_scene.permission_index} (${bundle.matched_scene.permission_name})`);
|
|
334
|
-
if (bundle.matched_scene.required_arb_status && bundle.matched_scene.required_arb_status.length > 0) {
|
|
335
|
-
lines.push(`Required Arb status: ${bundle.matched_scene.required_arb_status.join(" | ")}`);
|
|
336
|
-
}
|
|
337
|
-
if (bundle.matched_scene.resulting_arb_status) {
|
|
338
|
-
lines.push(`Resulting Arb status: ${bundle.matched_scene.resulting_arb_status}`);
|
|
339
|
-
}
|
|
340
|
-
lines.push(`Has _with_passport variant: ${bundle.matched_scene.has_passport_variant ? "YES" : "NO"}`);
|
|
341
|
-
lines.push("");
|
|
342
|
-
}
|
|
343
|
-
if (bundle.matched_template) {
|
|
344
|
-
lines.push(`Suggested template: ${bundle.matched_template.id} — ${bundle.matched_template.name}`);
|
|
345
|
-
lines.push(`Description: ${bundle.matched_template.description}`);
|
|
346
|
-
lines.push("");
|
|
347
|
-
}
|
|
348
|
-
if (bundle.matched_pattern) {
|
|
349
|
-
lines.push(`Matched pattern: ${bundle.matched_pattern.id} — ${bundle.matched_pattern.pattern_name}`);
|
|
350
|
-
lines.push(`Intent: ${bundle.matched_pattern.semantic_intent}`);
|
|
351
|
-
lines.push("");
|
|
352
|
-
}
|
|
353
|
-
if (h.include_puzzle_template && bundle.puzzle_completeness) {
|
|
354
|
-
const c = bundle.puzzle_completeness;
|
|
355
|
-
lines.push("─ Puzzle Completeness ──────────────");
|
|
356
|
-
lines.push(`Complete: ${c.complete ? "YES" : "NO"}`);
|
|
357
|
-
if (c.missing.length > 0) {
|
|
358
|
-
lines.push(`Missing dimensions: ${c.missing.join(", ")}`);
|
|
359
|
-
}
|
|
360
|
-
lines.push(`Next step: ${c.next_step}`);
|
|
361
|
-
lines.push("");
|
|
362
|
-
}
|
|
363
|
-
if (h.include_dual_guard_matrix && bundle.dual_guard_matrix_entry) {
|
|
364
|
-
const m = bundle.dual_guard_matrix_entry;
|
|
365
|
-
lines.push("─ Dual-Guard Matrix Entry ──────────────");
|
|
366
|
-
lines.push(`Voting guard: ${m.voting_guard_empty ? "EMPTY (open vote)" : "NON-EMPTY (weighted)"}`);
|
|
367
|
-
lines.push(`Usage guard: ${m.usage_guard_none ? "NONE (open dispute)" : "SOME (filtered dispute)"}`);
|
|
368
|
-
lines.push(`Vote method: ${m.vote_method}`);
|
|
369
|
-
lines.push(`Dispute method: ${m.dispute_method}`);
|
|
370
|
-
lines.push(`Scenario: ${m.scenario}`);
|
|
371
|
-
lines.push("");
|
|
372
|
-
}
|
|
373
|
-
if (h.include_arb_lifecycle && bundle.arb_lifecycle_context) {
|
|
374
|
-
const lc = bundle.arb_lifecycle_context;
|
|
375
|
-
lines.push("─ Arb 7-State Lifecycle Context ──────────────");
|
|
376
|
-
if (lc.current_status) {
|
|
377
|
-
lines.push(`Current Arb status: ${lc.current_status} (code ${lc.current_status_code})`);
|
|
378
|
-
lines.push(`Terminal: ${lc.is_terminal ? "YES — no further transitions" : "NO"}`);
|
|
379
|
-
if (lc.valid_next_statuses.length > 0) {
|
|
380
|
-
lines.push(`Valid next statuses: ${lc.valid_next_statuses.join(", ")}`);
|
|
381
|
-
}
|
|
382
|
-
if (lc.valid_operations_from_here.length > 0) {
|
|
383
|
-
lines.push(`Valid operations from here (${lc.valid_operations_from_here.length}):`);
|
|
384
|
-
for (const op of lc.valid_operations_from_here.slice(0, 6)) {
|
|
385
|
-
lines.push(` - ${op}`);
|
|
386
|
-
}
|
|
387
|
-
if (lc.valid_operations_from_here.length > 6) {
|
|
388
|
-
lines.push(` ... and ${lc.valid_operations_from_here.length - 6} more`);
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
lines.push("No current Arb status provided — lifecycle context inactive");
|
|
394
|
-
}
|
|
395
|
-
lines.push("");
|
|
396
|
-
}
|
|
397
|
-
if (h.include_risk_details && bundle.relevant_risks.length > 0) {
|
|
398
|
-
lines.push(`─ Relevant Risk Rules (${bundle.relevant_risks.length}) ──────────────`);
|
|
399
|
-
for (const r of bundle.relevant_risks.slice(0, 6)) {
|
|
400
|
-
lines.push(` ${r.id} — ${r.trigger}`);
|
|
401
|
-
}
|
|
402
|
-
if (bundle.relevant_risks.length > 6) {
|
|
403
|
-
lines.push(` ... and ${bundle.relevant_risks.length - 6} more`);
|
|
404
|
-
}
|
|
405
|
-
lines.push("");
|
|
406
|
-
}
|
|
407
|
-
if (bundle.risk_assessment) {
|
|
408
|
-
lines.push("─ Risk Assessment ──────────────");
|
|
409
|
-
lines.push(`Overall risk: ${bundle.risk_assessment.overall_risk}`);
|
|
410
|
-
lines.push(`Detected: ${bundle.risk_assessment.risks.length} risk(s)`);
|
|
411
|
-
if (bundle.risk_assessment.risks.length > 0) {
|
|
412
|
-
for (const r of bundle.risk_assessment.risks.slice(0, 3)) {
|
|
413
|
-
lines.push(` [${r.level}] ${r.id}: ${r.title}`);
|
|
414
|
-
}
|
|
415
|
-
if (bundle.risk_assessment.risks.length > 3) {
|
|
416
|
-
lines.push(` ... and ${bundle.risk_assessment.risks.length - 3} more`);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
lines.push("");
|
|
420
|
-
}
|
|
421
|
-
if (bundle.relevant_permissions.length > 0) {
|
|
422
|
-
lines.push(`─ Relevant Permissions (${bundle.relevant_permissions.length}) ──────────────`);
|
|
423
|
-
for (const p of bundle.relevant_permissions.slice(0, 10)) {
|
|
424
|
-
const reserved = p.is_reserved ? " [RESERVED]" : "";
|
|
425
|
-
lines.push(` [${p.index}] ${p.name}${reserved}: ${p.description}`);
|
|
426
|
-
}
|
|
427
|
-
if (bundle.relevant_permissions.length > 10) {
|
|
428
|
-
lines.push(` ... and ${bundle.relevant_permissions.length - 10} more`);
|
|
429
|
-
}
|
|
430
|
-
lines.push("");
|
|
431
|
-
}
|
|
432
|
-
if (bundle.relevant_constraints.length > 0) {
|
|
433
|
-
lines.push(`─ Relevant Constraint Rules (${bundle.relevant_constraints.length}) ──────────────`);
|
|
434
|
-
for (const c of bundle.relevant_constraints.slice(0, 5)) {
|
|
435
|
-
lines.push(` ${c.id} [${c.category}]: ${c.rule}`);
|
|
436
|
-
}
|
|
437
|
-
if (bundle.relevant_constraints.length > 5) {
|
|
438
|
-
lines.push(` ... and ${bundle.relevant_constraints.length - 5} more`);
|
|
439
|
-
}
|
|
440
|
-
lines.push("");
|
|
441
|
-
}
|
|
442
|
-
if (h.include_indemnity_warning) {
|
|
443
|
-
lines.push("⚠️ INDEMNITY OPERATION DETECTED — arbitration.indemnity transfers WOW from arbiter to disputant");
|
|
444
|
-
lines.push(" This is IRREVERSIBLE once the ruling is finalized. Verify indemnity amount carefully.");
|
|
445
|
-
lines.push("");
|
|
446
|
-
}
|
|
447
|
-
if (h.include_ownership_transfer_warning) {
|
|
448
|
-
lines.push("⚠️ OWNERSHIP TRANSFER DETECTED — builder field transfers Arbitration ownership");
|
|
449
|
-
lines.push(" This is IRREVERSIBLE. Original owner will lose all administrative rights.");
|
|
450
|
-
lines.push("");
|
|
451
|
-
}
|
|
452
|
-
if (h.include_immutability_warning) {
|
|
453
|
-
lines.push("ℹ️ POST-PUBLISH MODIFICATION — Arbitration is already on-chain");
|
|
454
|
-
lines.push(" Some fields can be modified (description, location, fee, voting_guard, usage_guard)");
|
|
455
|
-
lines.push(" but core properties (coin_type, permission object) are immutable.");
|
|
456
|
-
lines.push("");
|
|
457
|
-
}
|
|
458
|
-
if (bundle.cross_object_refs.length > 0) {
|
|
459
|
-
lines.push(`─ Cross-Object References (${bundle.cross_object_refs.length}) ──────────────`);
|
|
460
|
-
for (const r of bundle.cross_object_refs.slice(0, 6)) {
|
|
461
|
-
const arrow = r.direction === "references" ? "→" : "←";
|
|
462
|
-
lines.push(` ${arrow} ${r.object}.${r.field} (${r.direction}) — ${r.description}`);
|
|
463
|
-
}
|
|
464
|
-
if (bundle.cross_object_refs.length > 6) {
|
|
465
|
-
lines.push(` ... and ${bundle.cross_object_refs.length - 6} more`);
|
|
466
|
-
}
|
|
467
|
-
lines.push("");
|
|
468
|
-
}
|
|
469
|
-
if (bundle.onchain_constraints.length > 0) {
|
|
470
|
-
lines.push("─ On-chain Constraints ──────────────");
|
|
471
|
-
for (const c of bundle.onchain_constraints) {
|
|
472
|
-
lines.push(` ${c.name} = ${c.value} — ${c.description}`);
|
|
473
|
-
}
|
|
474
|
-
lines.push("");
|
|
475
|
-
}
|
|
476
|
-
return lines.join("\n");
|
|
477
|
-
}
|
|
478
|
-
export function getArbitrationContextSummary(bundle) {
|
|
479
|
-
const parts = [
|
|
480
|
-
`mode=${bundle.mode}`,
|
|
481
|
-
`scene=${bundle.matched_scene?.id ?? "none"}`,
|
|
482
|
-
`risks=${bundle.relevant_risks.length}`,
|
|
483
|
-
`permissions=${bundle.relevant_permissions.length}`,
|
|
484
|
-
`constraints=${bundle.relevant_constraints.length}`,
|
|
485
|
-
];
|
|
486
|
-
if (bundle.stakeholder_perspective)
|
|
487
|
-
parts.push(`stakeholder=${bundle.stakeholder_perspective}`);
|
|
488
|
-
if (bundle.risk_assessment)
|
|
489
|
-
parts.push(`overall_risk=${bundle.risk_assessment.overall_risk}`);
|
|
490
|
-
if (bundle.dual_guard_matrix_entry) {
|
|
491
|
-
parts.push(`dual_guard=${bundle.dual_guard_matrix_entry.vote_method}+${bundle.dual_guard_matrix_entry.dispute_method}`);
|
|
492
|
-
}
|
|
493
|
-
if (bundle.arb_lifecycle_context?.current_status) {
|
|
494
|
-
parts.push(`arb_status=${bundle.arb_lifecycle_context.current_status}`);
|
|
495
|
-
}
|
|
496
|
-
if (bundle.cross_object_refs.length > 0)
|
|
497
|
-
parts.push(`xrefs=${bundle.cross_object_refs.length}`);
|
|
498
|
-
return parts.join(", ");
|
|
499
|
-
}
|
|
500
|
-
export { ARBITRATION_LEDGER_VERSION, ARBITRATION_SCENES, ARBITRATION_PERMISSIONS, DUAL_GUARD_MATRIX, ARB_STATUS_CODE, ARB_TERMINAL_STATUSES, findSceneById, findSceneByPermissionIndex, inferSceneFromIntent, getScenesByCategory, getDualGuardMatrixEntry, isValidArbStatusTransition, isTerminalArbStatus, getActiveArbitrationPermissions, getAllArbitrationPermissions, } from "./arbitration-ledger.js";
|
|
501
|
-
export { ARBITRATION_TEMPLATES_VERSION, ARBITRATION_TEMPLATES, suggestTemplateForScene, getTemplatesByScene, getTemplateById, } from "./arbitration-templates.js";
|
|
502
|
-
export { ARBITRATION_TRANSLATION_VERSION, SEMANTIC_TO_SCHEMA_RULES, ARBITRATION_CONSTRAINT_RULES, matchSemanticPattern, explainArbitrationCallData, explainPermissionIndex, explainArbStatus, } from "./arbitration-translation.js";
|
|
503
|
-
export { ARBITRATION_RISK_VERSION, getAllRiskRules, assessArbitrationRisks, } from "./arbitration-risk.js";
|
|
504
|
-
export { ARBITRATION_CONFIRM_VERSION, ARBITRATION_OPERATION_CHECKLIST, ARBITRATION_CONFIRMATION_QUESTIONS, runArbitrationConfirmGate, } from "./arbitration-confirm.js";
|
|
505
|
-
export { initPuzzleFromIntent, checkPuzzleCompleteness, validateConstraints, } from "./arbitration-puzzle.js";
|
|
1
|
+
import{MAX_VOTING_GUARD_COUNT}from'@wowok/wowok';import{ARBITRATION_SCENES,DUAL_GUARD_MATRIX,ARB_STATUS_CODE,ARB_TERMINAL_STATUSES,findSceneByPermissionIndex,inferSceneFromIntent,getScenesByCategory,getDualGuardMatrixEntry,isValidArbStatusTransition,isTerminalArbStatus,getActiveArbitrationPermissions,getAllArbitrationPermissions}from'./arbitration-ledger.js';import{getTemplatesByScene}from'./arbitration-templates.js';import{ARBITRATION_CONSTRAINT_RULES,matchSemanticPattern}from'./arbitration-translation.js';import{getAllRiskRules,assessArbitrationRisks}from'./arbitration-risk.js';import{initPuzzleFromIntent,checkPuzzleCompleteness}from'./arbitration-puzzle.js';import{ARBITRATION_OPERATION_CHECKLIST,ARBITRATION_CONFIRMATION_QUESTIONS}from'./arbitration-confirm.js';export const ARBITRATION_CONTEXT_VERSION='1.0.0';export function buildArbitrationContext(a){const b=a['max_length']??0x1194;let c;if(a['intent'])c=inferSceneFromIntent(a['intent']);else{if(a['target_permission_index']!==undefined)c=findSceneByPermissionIndex(a['target_permission_index']);else{if(a['target_operation_category']){const s=getScenesByCategory(a['target_operation_category']);if(s['length']>0x0)c=s[0x0];}}}let d;if(c){const t=getTemplatesByScene(c['id']);if(t['length']>0x0)d=t[0x0];}let e;if(a['intent']){const u=matchSemanticPattern(a['intent']);if(u['length']>0x0)e=u[0x0];}let f,g;a['mode']==='initial_design'&&a['intent']&&(f=initPuzzleFromIntent({'rule_sentence':a['intent']}),g=checkPuzzleCompleteness(f));const h=filterRiskRules(a['mode'],a['stakeholder'],c);let i;if(a['mode']==='pre_publish'&&a['arbitration_json']){const v={'object':a['arbitration_json']['object'],'description':a['arbitration_json']['description'],'location':a['arbitration_json']['location'],'fee':a['arbitration_json']['fee'],'pause':a['arbitration_json']['pause'],'dispute':a['arbitration_json']['dispute'],'confirm':a['arbitration_json']['confirm'],'voting_deadline_change':a['arbitration_json']['voting_deadline_change'],'vote':a['arbitration_json']['vote'],'feedback':a['arbitration_json']['feedback'],'arbitration':a['arbitration_json']['arbitration'],'reset':a['arbitration_json']['reset'],'arb_withdraw':a['arbitration_json']['arb_withdraw'],'fees_transfer':a['arbitration_json']['fees_transfer'],'usage_guard':a['arbitration_json']['usage_guard'],'voting_guard':a['arbitration_json']['voting_guard'],'um':a['arbitration_json']['um'],'builder':a['arbitration_json']['builder'],'current_arb_status':a['current_arb_status'],'expected_arb_status':a['arbitration_json']['arbitration']?'Arbitrated':a['current_arb_status']};i=assessArbitrationRisks(v);}const j=filterChecklist(a['mode']),k=filterQuestions(a['mode']),l=filterConstraints(a['mode'],c),m=a['stakeholder']==='system'?getAllArbitrationPermissions():getActiveArbitrationPermissions();let n;if(a['voting_guard_empty']!==undefined&&a['usage_guard_none']!==undefined)n=getDualGuardMatrixEntry(a['voting_guard_empty'],a['usage_guard_none']);else{if(c){const w=c['requires_voting_guard']==='empty',x=c['requires_usage_guard']==='none';n=getDualGuardMatrixEntry(w,x);}}const o=buildArbLifecycleContext(a['current_arb_status'],c),p=buildCrossObjectRefs(c),q=buildOnchainConstraints(),r=buildRenderingHints(a['mode'],b,!!a['arbitration_json']?.['arbitration'],!!a['arbitration_json']?.['builder']);return{'version':ARBITRATION_CONTEXT_VERSION,'mode':a['mode'],'stakeholder_perspective':a['stakeholder'],'matched_scene':c,'matched_template':d,'matched_pattern':e,'puzzle_state':f,'puzzle_completeness':g,'relevant_risks':h,'risk_assessment':i,'relevant_checklist':j,'relevant_questions':k,'relevant_permissions':m,'relevant_constraints':l,'dual_guard_matrix_entry':n,'arb_lifecycle_context':o,'cross_object_refs':p,'onchain_constraints':q,'rendering_hints':r};}function filterRiskRules(a,b,c){const d=getAllRiskRules();if(a==='initial_design')return d['filter'](e=>e['category']==='structural'||e['category']==='authority');if(a==='pre_publish')return d;if(a==='stakeholder_review'&&b){if(b==='owner')return d['filter'](e=>e['category']==='authority'||e['category']==='lifecycle'||e['category']==='cross_object');if(b==='arbiter')return d['filter'](e=>e['category']==='authority'||e['category']==='lifecycle');if(b==='voter')return d['filter'](e=>e['category']==='structural'||e['category']==='lifecycle');if(b==='disputant')return d['filter'](e=>e['category']==='semantic'||e['category']==='lifecycle');if(b==='system')return d['filter'](e=>e['category']==='structural'||e['category']==='cross_object');}if(a==='post_publish_modify')return d['filter'](e=>e['category']==='lifecycle'||e['category']==='cross_object');return d;}function filterChecklist(a){if(a==='initial_design')return ARBITRATION_OPERATION_CHECKLIST['filter'](b=>['C-AB-01','C-AB-02','C-AB-03','C-AB-04']['includes'](b['id']));return[...ARBITRATION_OPERATION_CHECKLIST];}function filterQuestions(a){if(a==='pre_publish')return[...ARBITRATION_CONFIRMATION_QUESTIONS];if(a==='post_publish_modify')return ARBITRATION_CONFIRMATION_QUESTIONS['filter'](b=>b['id']!=='QAB5');return[];}function filterConstraints(a,b){if(a==='initial_design')return ARBITRATION_CONSTRAINT_RULES['filter'](d=>d['category']==='structural');if(a==='pre_publish')return[...ARBITRATION_CONSTRAINT_RULES];if(b){const c={'lifecycle':['structural','authority'],'dispute':['semantic','lifecycle'],'voting':['semantic','lifecycle'],'ruling':['authority','lifecycle'],'fund':['cross_object'],'guard':['structural','semantic'],'governance':['authority']},d=c[b['operation_category']]??[];return ARBITRATION_CONSTRAINT_RULES['filter'](e=>d['includes'](e['category']));}return[...ARBITRATION_CONSTRAINT_RULES];}function buildArbLifecycleContext(a,b){if(!a&&!b)return undefined;const c=a?isTerminalArbStatus(a):![],d=[];if(a){const f=['Principal_confirming','Arbitrator_confirming','Voting','Arbitrated','Objectionable','Finished','Withdrawn'];for(const g of f){g!==a&&isValidArbStatusTransition(a,g)&&d['push'](g);}}const e=[];for(const h of ARBITRATION_SCENES){a&&h['required_arb_status']&&h['required_arb_status']['includes'](a)&&e['push'](h['id']);}return{'current_status':a,'current_status_code':a?ARB_STATUS_CODE[a]:undefined,'is_terminal':c,'valid_next_statuses':d,'valid_operations_from_here':e};}function buildCrossObjectRefs(a){const b=[],c=[{'object':'Order','field':'dispute.order','scene_id':'arbitration_dispute','description':'dispute()\x20takes\x20Order\x20address\x20—\x20Order\x20is\x20the\x20source\x20of\x20disputes','direction':'references'},{'object':'Arb','field':'dispute\x20(spawns\x20Arb)','scene_id':'arbitration_dispute','description':'Each\x20dispute()\x20creates\x20a\x20new\x20Arb\x20case\x20object\x20with\x207-state\x20lifecycle','direction':'references'},{'object':'Guard','field':'voting_guard\x20/\x20usage_guard','scene_id':'arbitration_voting_guard_config\x20/\x20arbitration_usage_guard_config','description':'voting_guard\x20controls\x20vote\x20weight\x20(max\x2050);\x20usage_guard\x20filters\x20who\x20can\x20file\x20disputes','direction':'references'},{'object':'Allocation','field':'fees_transfer.to.allocation','scene_id':'arbitration_fees_transfer','description':'Withdrawn\x20fees\x20can\x20be\x20routed\x20to\x20Allocation\x20for\x20arbiter\x20compensation\x20distribution','direction':'references'},{'object':'Treasury','field':'fees_transfer.to.treasury','scene_id':'arbitration_fees_transfer','description':'Withdrawn\x20fees\x20can\x20be\x20routed\x20to\x20Treasury\x20as\x20alternative\x20destination','direction':'references'},{'object':'Contact','field':'um','scene_id':'arbitration_um_set','description':'um\x20(Contact\x20object)\x20for\x20arbitrator\x20↔\x20disputant\x20communication\x20channel','direction':'references'},{'object':'Payment','field':'fees_transfer.payment_remark\x20/\x20payment_index','scene_id':'arbitration_fees_transfer','description':'fees_transfer\x20creates\x20Payment\x20object\x20with\x20remark\x20+\x20index\x20for\x20audit\x20trail','direction':'references'}],d=[{'object':'Service','field':'arbitrations\x20(MAX_ARBITRATION_COUNT=20)','scene_id':'service_arbitration_config','description':'Service\x20embeds\x20up\x20to\x2020\x20Arbitration\x20references\x20for\x20dispute\x20resolution\x20per\x20service','direction':'referenced_by'}];if(a){const e=a['id'];return[...c,...d]['filter'](f=>f['scene_id']===e||f['scene_id']['includes'](e['split']('_')[0x1]??''));}return[...c,...d];}function buildOnchainConstraints(){return[{'name':'MAX_VOTING_GUARD_COUNT','value':MAX_VOTING_GUARD_COUNT,'description':'Maximum\x20voting_guard\x20entries\x20per\x20Arbitration\x20(Move\x20source:\x20arbitration.move:25)'},{'name':'ARBITRATION_PERMISSION_INDEX_RANGE','value':'350-368\x20(352\x20reserved)','description':'19\x20built-in\x20permission\x20indexes\x20for\x20Arbitration\x20—\x20most\x20among\x20all\x2022\x20objects'},{'name':'ARB_STATE_COUNT','value':0x7,'description':'Arb\x20has\x207-state\x20lifecycle:\x20Principal_confirming\x20→\x20Arbitrator_confirming\x20→\x20Voting\x20→\x20Arbitrated\x20→\x20Objectionable\x20→\x20Finished/Withdrawn'},{'name':'ARB_TERMINAL_STATUSES','value':ARB_TERMINAL_STATUSES['length'],'description':'Terminal\x20statuses:\x20'+ARB_TERMINAL_STATUSES['join'](',\x20')+'\x20(no\x20further\x20transitions)'},{'name':'DUAL_GUARD_COMBINATIONS','value':DUAL_GUARD_MATRIX['length'],'description':'4\x20dual-Guard\x20combos:\x20(voting_guard\x20empty/non-empty)\x20×\x20(usage_guard\x20none/some)'}];}function buildRenderingHints(a,b,c,d){return{'include_puzzle_template':a==='initial_design','include_risk_details':a==='pre_publish'||a==='stakeholder_review','include_questions':a==='pre_publish','include_dual_guard_matrix':a==='initial_design'||a==='pre_publish','include_arb_lifecycle':a==='pre_publish'||a==='post_publish_modify'||a==='stakeholder_review','include_immutability_warning':a==='post_publish_modify','include_indemnity_warning':c,'include_ownership_transfer_warning':d,'max_length':b};}export function buildPromptFromArbitrationContext(a){const b=[],d=a['rendering_hints'];b['push']('═══\x20Arbitration\x20Context\x20(mode:\x20'+a['mode']+')\x20═══'),b['push']('');a['stakeholder_perspective']&&(b['push']('Stakeholder\x20perspective:\x20'+a['stakeholder_perspective']),b['push'](''));a['matched_scene']&&(b['push']('Scene:\x20'+a['matched_scene']['name']),b['push']('Category:\x20'+a['matched_scene']['operation_category']),b['push']('Permission\x20index:\x20'+a['matched_scene']['permission_index']+'\x20('+a['matched_scene']['permission_name']+')'),a['matched_scene']['required_arb_status']&&a['matched_scene']['required_arb_status']['length']>0x0&&b['push']('Required\x20Arb\x20status:\x20'+a['matched_scene']['required_arb_status']['join']('\x20|\x20')),a['matched_scene']['resulting_arb_status']&&b['push']('Resulting\x20Arb\x20status:\x20'+a['matched_scene']['resulting_arb_status']),b['push']('Has\x20_with_passport\x20variant:\x20'+(a['matched_scene']['has_passport_variant']?'YES':'NO')),b['push'](''));a['matched_template']&&(b['push']('Suggested\x20template:\x20'+a['matched_template']['id']+'\x20—\x20'+a['matched_template']['name']),b['push']('Description:\x20'+a['matched_template']['description']),b['push'](''));a['matched_pattern']&&(b['push']('Matched\x20pattern:\x20'+a['matched_pattern']['id']+'\x20—\x20'+a['matched_pattern']['pattern_name']),b['push']('Intent:\x20'+a['matched_pattern']['semantic_intent']),b['push'](''));if(d['include_puzzle_template']&&a['puzzle_completeness']){const e=a['puzzle_completeness'];b['push']('─\x20Puzzle\x20Completeness\x20──────────────'),b['push']('Complete:\x20'+(e['complete']?'YES':'NO')),e['missing']['length']>0x0&&b['push']('Missing\x20dimensions:\x20'+e['missing']['join'](',\x20')),b['push']('Next\x20step:\x20'+e['next_step']),b['push']('');}if(d['include_dual_guard_matrix']&&a['dual_guard_matrix_entry']){const f=a['dual_guard_matrix_entry'];b['push']('─\x20Dual-Guard\x20Matrix\x20Entry\x20──────────────'),b['push']('Voting\x20guard:\x20'+(f['voting_guard_empty']?'EMPTY\x20(open\x20vote)':'NON-EMPTY\x20(weighted)')),b['push']('Usage\x20guard:\x20'+(f['usage_guard_none']?'NONE\x20(open\x20dispute)':'SOME\x20(filtered\x20dispute)')),b['push']('Vote\x20method:\x20'+f['vote_method']),b['push']('Dispute\x20method:\x20'+f['dispute_method']),b['push']('Scenario:\x20'+f['scenario']),b['push']('');}if(d['include_arb_lifecycle']&&a['arb_lifecycle_context']){const g=a['arb_lifecycle_context'];b['push']('─\x20Arb\x207-State\x20Lifecycle\x20Context\x20──────────────');if(g['current_status']){b['push']('Current\x20Arb\x20status:\x20'+g['current_status']+'\x20(code\x20'+g['current_status_code']+')'),b['push']('Terminal:\x20'+(g['is_terminal']?'YES\x20—\x20no\x20further\x20transitions':'NO'));g['valid_next_statuses']['length']>0x0&&b['push']('Valid\x20next\x20statuses:\x20'+g['valid_next_statuses']['join'](',\x20'));if(g['valid_operations_from_here']['length']>0x0){b['push']('Valid\x20operations\x20from\x20here\x20('+g['valid_operations_from_here']['length']+'):');for(const i of g['valid_operations_from_here']['slice'](0x0,0x6)){b['push']('\x20\x20-\x20'+i);}g['valid_operations_from_here']['length']>0x6&&b['push']('\x20\x20...\x20and\x20'+(g['valid_operations_from_here']['length']-0x6)+'\x20more');}}else b['push']('No\x20current\x20Arb\x20status\x20provided\x20—\x20lifecycle\x20context\x20inactive');b['push']('');}if(d['include_risk_details']&&a['relevant_risks']['length']>0x0){b['push']('─\x20Relevant\x20Risk\x20Rules\x20('+a['relevant_risks']['length']+')\x20──────────────');for(const j of a['relevant_risks']['slice'](0x0,0x6)){b['push']('\x20\x20'+j['id']+'\x20—\x20'+j['trigger']);}a['relevant_risks']['length']>0x6&&b['push']('\x20\x20...\x20and\x20'+(a['relevant_risks']['length']-0x6)+'\x20more'),b['push']('');}if(a['risk_assessment']){b['push']('─\x20Risk\x20Assessment\x20──────────────'),b['push']('Overall\x20risk:\x20'+a['risk_assessment']['overall_risk']),b['push']('Detected:\x20'+a['risk_assessment']['risks']['length']+'\x20risk(s)');if(a['risk_assessment']['risks']['length']>0x0){for(const k of a['risk_assessment']['risks']['slice'](0x0,0x3)){b['push']('\x20\x20['+k['level']+']\x20'+k['id']+':\x20'+k['title']);}a['risk_assessment']['risks']['length']>0x3&&b['push']('\x20\x20...\x20and\x20'+(a['risk_assessment']['risks']['length']-0x3)+'\x20more');}b['push']('');}if(a['relevant_permissions']['length']>0x0){b['push']('─\x20Relevant\x20Permissions\x20('+a['relevant_permissions']['length']+')\x20──────────────');for(const l of a['relevant_permissions']['slice'](0x0,0xa)){const n=l['is_reserved']?'\x20[RESERVED]':'';b['push']('\x20\x20['+l['index']+']\x20'+l['name']+n+':\x20'+l['description']);}a['relevant_permissions']['length']>0xa&&b['push']('\x20\x20...\x20and\x20'+(a['relevant_permissions']['length']-0xa)+'\x20more'),b['push']('');}if(a['relevant_constraints']['length']>0x0){b['push']('─\x20Relevant\x20Constraint\x20Rules\x20('+a['relevant_constraints']['length']+')\x20──────────────');for(const o of a['relevant_constraints']['slice'](0x0,0x5)){b['push']('\x20\x20'+o['id']+'\x20['+o['category']+']:\x20'+o['rule']);}a['relevant_constraints']['length']>0x5&&b['push']('\x20\x20...\x20and\x20'+(a['relevant_constraints']['length']-0x5)+'\x20more'),b['push']('');}d['include_indemnity_warning']&&(b['push']('⚠️\x20INDEMNITY\x20OPERATION\x20DETECTED\x20—\x20arbitration.indemnity\x20transfers\x20WOW\x20from\x20arbiter\x20to\x20disputant'),b['push']('\x20\x20\x20This\x20is\x20IRREVERSIBLE\x20once\x20the\x20ruling\x20is\x20finalized.\x20Verify\x20indemnity\x20amount\x20carefully.'),b['push'](''));d['include_ownership_transfer_warning']&&(b['push']('⚠️\x20OWNERSHIP\x20TRANSFER\x20DETECTED\x20—\x20builder\x20field\x20transfers\x20Arbitration\x20ownership'),b['push']('\x20\x20\x20This\x20is\x20IRREVERSIBLE.\x20Original\x20owner\x20will\x20lose\x20all\x20administrative\x20rights.'),b['push'](''));d['include_immutability_warning']&&(b['push']('ℹ️\x20POST-PUBLISH\x20MODIFICATION\x20—\x20Arbitration\x20is\x20already\x20on-chain'),b['push']('\x20\x20\x20Some\x20fields\x20can\x20be\x20modified\x20(description,\x20location,\x20fee,\x20voting_guard,\x20usage_guard)'),b['push']('\x20\x20\x20but\x20core\x20properties\x20(coin_type,\x20permission\x20object)\x20are\x20immutable.'),b['push'](''));if(a['cross_object_refs']['length']>0x0){b['push']('─\x20Cross-Object\x20References\x20('+a['cross_object_refs']['length']+')\x20──────────────');for(const q of a['cross_object_refs']['slice'](0x0,0x6)){const s=q['direction']==='references'?'→':'←';b['push']('\x20\x20'+s+'\x20'+q['object']+'.'+q['field']+'\x20('+q['direction']+')\x20—\x20'+q['description']);}a['cross_object_refs']['length']>0x6&&b['push']('\x20\x20...\x20and\x20'+(a['cross_object_refs']['length']-0x6)+'\x20more'),b['push']('');}if(a['onchain_constraints']['length']>0x0){b['push']('─\x20On-chain\x20Constraints\x20──────────────');for(const t of a['onchain_constraints']){b['push']('\x20\x20'+t['name']+'\x20=\x20'+t['value']+'\x20—\x20'+t['description']);}b['push']('');}return b['join']('\x0a');}export function getArbitrationContextSummary(a){const b=['mode='+a['mode'],'scene='+(a['matched_scene']?.['id']??'none'),'risks='+a['relevant_risks']['length'],'permissions='+a['relevant_permissions']['length'],'constraints='+a['relevant_constraints']['length']];if(a['stakeholder_perspective'])b['push']('stakeholder='+a['stakeholder_perspective']);if(a['risk_assessment'])b['push']('overall_risk='+a['risk_assessment']['overall_risk']);a['dual_guard_matrix_entry']&&b['push']('dual_guard='+a['dual_guard_matrix_entry']['vote_method']+'+'+a['dual_guard_matrix_entry']['dispute_method']);a['arb_lifecycle_context']?.['current_status']&&b['push']('arb_status='+a['arb_lifecycle_context']['current_status']);if(a['cross_object_refs']['length']>0x0)b['push']('xrefs='+a['cross_object_refs']['length']);return b['join'](',\x20');}export{ARBITRATION_LEDGER_VERSION,ARBITRATION_SCENES,ARBITRATION_PERMISSIONS,DUAL_GUARD_MATRIX,ARB_STATUS_CODE,ARB_TERMINAL_STATUSES,findSceneById,findSceneByPermissionIndex,inferSceneFromIntent,getScenesByCategory,getDualGuardMatrixEntry,isValidArbStatusTransition,isTerminalArbStatus,getActiveArbitrationPermissions,getAllArbitrationPermissions}from'./arbitration-ledger.js';export{ARBITRATION_TEMPLATES_VERSION,ARBITRATION_TEMPLATES,suggestTemplateForScene,getTemplatesByScene,getTemplateById}from'./arbitration-templates.js';export{ARBITRATION_TRANSLATION_VERSION,SEMANTIC_TO_SCHEMA_RULES,ARBITRATION_CONSTRAINT_RULES,matchSemanticPattern,explainArbitrationCallData,explainPermissionIndex,explainArbStatus}from'./arbitration-translation.js';export{ARBITRATION_RISK_VERSION,getAllRiskRules,assessArbitrationRisks}from'./arbitration-risk.js';export{ARBITRATION_CONFIRM_VERSION,ARBITRATION_OPERATION_CHECKLIST,ARBITRATION_CONFIRMATION_QUESTIONS,runArbitrationConfirmGate}from'./arbitration-confirm.js';export{initPuzzleFromIntent,checkPuzzleCompleteness,validateConstraints}from'./arbitration-puzzle.js';
|