@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,405 +1 @@
|
|
|
1
|
-
import { isProgressBuiltinPermission, getBuiltinPermissionByIndex, } from "./progress-ledger.js";
|
|
2
|
-
export const PROGRESS_SEMANTIC_TO_SCHEMA_RULES = [
|
|
3
|
-
{
|
|
4
|
-
id: "P-PR-01",
|
|
5
|
-
pattern_name: "Advance Progress (next / order_next)",
|
|
6
|
-
semantic_intent: "Push Progress forward via a Forward definition; accumulate weight, possibly complete session",
|
|
7
|
-
match_keywords: ["next", "advance", "proceed", "complete forward"],
|
|
8
|
-
schema_fields: ["object", "operate(operation, op='next')"],
|
|
9
|
-
example_json: {
|
|
10
|
-
object: "0xPROGRESS_ADDRESS",
|
|
11
|
-
operate: {
|
|
12
|
-
operation: { next_node_name: "shipped", forward: "ship" },
|
|
13
|
-
op: "next",
|
|
14
|
-
message: "Order shipped via FedEx, tracking 12345",
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
reverse_explanation: "operate.op='next' → calls progress::next or order_next (if task bound). " +
|
|
18
|
-
"Move accumulates forward.weight; on reaching threshold, session → history and current = next_node_name. " +
|
|
19
|
-
"⚠ ROUTING RULE: When Forward.namedOperator=\"\" (empty string = OrderHolder), the caller MUST use " +
|
|
20
|
-
"order.progress (not progress.operate) — order_next uses order.has_op_permission which recognizes " +
|
|
21
|
-
"the OrderHolder short-circuit. Direct progress::next will abort with 'Permission denied' (code 5). " +
|
|
22
|
-
"For non-empty namedOperator or permissionIndex-only forwards, use progress.operate directly.",
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
id: "P-PR-02",
|
|
26
|
-
pattern_name: "Hold Progress (block forward)",
|
|
27
|
-
semantic_intent: "Lock a Forward so no one else can advance it until unhold",
|
|
28
|
-
match_keywords: ["hold", "lock", "block", "pause forward"],
|
|
29
|
-
schema_fields: ["object", "operate(operation, op='hold', message)"],
|
|
30
|
-
example_json: {
|
|
31
|
-
object: "0xPROGRESS_ADDRESS",
|
|
32
|
-
operate: {
|
|
33
|
-
operation: { next_node_name: "revision_required", forward: "request_revision" },
|
|
34
|
-
op: "hold",
|
|
35
|
-
message: "Please revise section 3",
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
reverse_explanation: "operate.op='hold' → calls progress::hold or order_hold. session_hold sets Holder.who = sender; " +
|
|
39
|
-
"other callers will hit E_NOT_THE_HOLDER if they try to advance.",
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
id: "P-PR-03",
|
|
43
|
-
pattern_name: "Self-unhold (release own hold)",
|
|
44
|
-
semantic_intent: "Release a forward that I previously held",
|
|
45
|
-
match_keywords: ["unhold", "release", "self release"],
|
|
46
|
-
schema_fields: ["object", "operate(operation, op='unhold')"],
|
|
47
|
-
example_json: {
|
|
48
|
-
object: "0xPROGRESS_ADDRESS",
|
|
49
|
-
operate: {
|
|
50
|
-
operation: { next_node_name: "reviewing", forward: "resubmit" },
|
|
51
|
-
op: "unhold",
|
|
52
|
-
message: "Revised content uploaded",
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
reverse_explanation: "operate.op='unhold' → calls progress::hold(bHold=false) or order_hold(bHold=false). " +
|
|
56
|
-
"Move's session_hold releases the lock (sender == Holder.who). " +
|
|
57
|
-
"After release, the forward can be re-locked or accomplished by eligible callers.",
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
id: "P-PR-04",
|
|
61
|
-
pattern_name: "Admin force-unhold (224 permission)",
|
|
62
|
-
semantic_intent: "Force-release a held forward using 224 permission, bypassing holder check",
|
|
63
|
-
match_keywords: ["adminUnhold", "force unhold", "admin release"],
|
|
64
|
-
schema_fields: ["object", "operate(operation, op='adminUnhold')"],
|
|
65
|
-
example_json: {
|
|
66
|
-
object: "0xPROGRESS_ADDRESS",
|
|
67
|
-
operate: {
|
|
68
|
-
operation: { next_node_name: "arb_decided", forward: "decide" },
|
|
69
|
-
op: "adminUnhold",
|
|
70
|
-
message: "Admin override: holder unresponsive for 7 days",
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
reverse_explanation: "operate.op='adminUnhold' → calls progress::unhold. Move checks sender_has_permission_idcheck(224); " +
|
|
74
|
-
"if true, force release (bForce=true). If false, falls back to holder-match check.",
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
id: "P-PR-05",
|
|
78
|
-
pattern_name: "Bind task (one-time, immutable)",
|
|
79
|
-
semantic_intent: "Associate an Order/Reward address with this Progress (only once per Progress)",
|
|
80
|
-
match_keywords: ["task_set", "bind task", "set task"],
|
|
81
|
-
schema_fields: ["object", "task"],
|
|
82
|
-
example_json: {
|
|
83
|
-
object: "0xPROGRESS_ADDRESS",
|
|
84
|
-
task: "0xORDER_ADDRESS",
|
|
85
|
-
},
|
|
86
|
-
reverse_explanation: "Calls progress::task_set. Move asserts option::is_none(&self.task); if already set, E_TASK_ALREADY_SET aborts. " +
|
|
87
|
-
"There is NO task_unset — once bound, the Progress is permanently tied to that Order/Reward.",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
id: "P-PR-06",
|
|
91
|
-
pattern_name: "Manage context repositories",
|
|
92
|
-
semantic_intent: "Add/remove/clear Repository objects as query context (≤ 30 total)",
|
|
93
|
-
match_keywords: ["repository", "context"],
|
|
94
|
-
schema_fields: ["object", "repository(op, objects)"],
|
|
95
|
-
example_json: {
|
|
96
|
-
object: "0xPROGRESS_ADDRESS",
|
|
97
|
-
repository: { op: "add", objects: ["0xREPO1", "0xREPO2"] },
|
|
98
|
-
},
|
|
99
|
-
reverse_explanation: "op=add: appends (idempotent via vector::contains). op=remove: drops listed addresses. " +
|
|
100
|
-
"op=clear: empties the list. op=set: clears then adds. Count must stay ≤ MAX_CONTEXT_REPOSITORY_COUNT (30).",
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
id: "P-PR-07",
|
|
104
|
-
pattern_name: "Manage named_operator namespace",
|
|
105
|
-
semantic_intent: "Add/set/remove addresses for a named operator role (Forward gate)",
|
|
106
|
-
match_keywords: ["named_operator", "operator"],
|
|
107
|
-
schema_fields: ["object", "progress_namedOperator(op, name, operators)"],
|
|
108
|
-
example_json: {
|
|
109
|
-
object: "0xPROGRESS_ADDRESS",
|
|
110
|
-
progress_namedOperator: {
|
|
111
|
-
op: "add",
|
|
112
|
-
name: "logistics",
|
|
113
|
-
operators: ["0xADDR1", "0xADDR2"],
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
reverse_explanation: "op=add: appends (deduped). op=set: REPLACES the address list. op=remove: drops listed addresses. " +
|
|
117
|
-
"Up to 60 named_operator names per Progress; up to 80 addresses per name.",
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: "P-PR-08",
|
|
121
|
-
pattern_name: "Owner receive (terminal node unwrap)",
|
|
122
|
-
semantic_intent: "Owner receives Receiving<K> objects or CoinWrapper<T> coins at a terminal node",
|
|
123
|
-
match_keywords: ["owner_receive", "unwrap", "withdraw"],
|
|
124
|
-
schema_fields: ["(SDK does not expose this in CallProgress_Data — direct move call required)"],
|
|
125
|
-
example_json: {
|
|
126
|
-
_note: "Not exposed in CallProgress_Data; direct Move call:",
|
|
127
|
-
target: "progress::owner_receive<T>",
|
|
128
|
-
arguments: ["progress", "machine", "permission", "received", "payment"],
|
|
129
|
-
},
|
|
130
|
-
reverse_explanation: "Calls progress::owner_receive (225 permission). Unwraps CoinWrapper<T> via Payment.unwrap_with_check, " +
|
|
131
|
-
"forwards coin/object to Permission owner. Typically triggered at terminal nodes (return_approved, completed, enforced).",
|
|
132
|
-
},
|
|
133
|
-
];
|
|
134
|
-
export const PROGRESS_SCHEMA_TO_SEMANTIC_RULES = [
|
|
135
|
-
{
|
|
136
|
-
element_type: "field",
|
|
137
|
-
type_name: "object",
|
|
138
|
-
semantic_explanation: "Progress object address. Always required for operate calls (Progress is created indirectly via service::buy).",
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
element_type: "field",
|
|
142
|
-
type_name: "task",
|
|
143
|
-
semantic_explanation: "Bind a task (Order/Reward) address. ONE-TIME only — E_TASK_ALREADY_SET on re-set.",
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
element_type: "field",
|
|
147
|
-
type_name: "repository",
|
|
148
|
-
semantic_explanation: "Context Repository list management. op=add/set/remove/clear. Total ≤ MAX_CONTEXT_REPOSITORY_COUNT (30).",
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
element_type: "field",
|
|
152
|
-
type_name: "progress_namedOperator",
|
|
153
|
-
semantic_explanation: "named_operator namespace management. name='' is the OrderHolder special namespace. ≤ 60 names, ≤ 80 addresses each.",
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
element_type: "field",
|
|
157
|
-
type_name: "operate",
|
|
158
|
-
semantic_explanation: "Forward advancement / hold / unhold. Contains operation (next_node_name + forward) and hold/adminUnhold/message flags.",
|
|
159
|
-
},
|
|
160
|
-
{
|
|
161
|
-
element_type: "field",
|
|
162
|
-
type_name: "operate.operation.next_node_name",
|
|
163
|
-
semantic_explanation: "Target node name. Must exist in Machine and be reachable from current via a Forward definition.",
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
element_type: "field",
|
|
167
|
-
type_name: "operate.operation.forward",
|
|
168
|
-
semantic_explanation: "Forward name. Must be one of the forwards defined from current → next_node_name in the Machine.",
|
|
169
|
-
},
|
|
170
|
-
{
|
|
171
|
-
element_type: "field",
|
|
172
|
-
type_name: "operate.op",
|
|
173
|
-
semantic_explanation: "Operation type: 'next' = advance forward; 'hold' = lock forward (Holder.who = sender); 'unhold' = self-release own hold; 'adminUnhold' = force release via 224 permission (bypasses holder check).",
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
element_type: "field",
|
|
177
|
-
type_name: "operate.message",
|
|
178
|
-
semantic_explanation: "Deliverable message (≤ MAX_LONG_NAME_LENGTH). Stored in Holder.msg / delivered on accomplishment.",
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
element_type: "op",
|
|
182
|
-
type_name: "next",
|
|
183
|
-
semantic_explanation: "Plain forward advance. Use when no bound Order, OR caller is named_operator (not OrderHolder).",
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
element_type: "op",
|
|
187
|
-
type_name: "order_next",
|
|
188
|
-
semantic_explanation: "Order-bound forward advance. Caller must satisfy order.has_op_permission (order owner/agent).",
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
element_type: "op",
|
|
192
|
-
type_name: "hold",
|
|
193
|
-
semantic_explanation: "Lock forward. Holder.who = sender; subsequent callers hit E_NOT_THE_HOLDER.",
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
element_type: "op",
|
|
197
|
-
type_name: "order_hold",
|
|
198
|
-
semantic_explanation: "Order-bound hold. Same as hold but uses order.has_op_permission for OrderHolder verification.",
|
|
199
|
-
},
|
|
200
|
-
{
|
|
201
|
-
element_type: "op",
|
|
202
|
-
type_name: "unhold",
|
|
203
|
-
semantic_explanation: "Self-release (sender == Holder.who) OR admin force-release (224 permission).",
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
element_type: "op",
|
|
207
|
-
type_name: "namedOperator_add",
|
|
208
|
-
semantic_explanation: "Append addresses to a named_operator (deduped; fails if name new and ≥ 60 names).",
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
element_type: "op",
|
|
212
|
-
type_name: "namedOperator_set",
|
|
213
|
-
semantic_explanation: "REPLACE the address list for a named_operator name (or create if name new).",
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
element_type: "op",
|
|
217
|
-
type_name: "namedOperator_remove",
|
|
218
|
-
semantic_explanation: "Drop listed addresses from a named_operator name (no-op if name doesn't exist).",
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
element_type: "phase",
|
|
222
|
-
type_name: "creation",
|
|
223
|
-
semantic_explanation: "Indirect: service::buy → progress::new_imp (bypasses 220 assertion via package-internal entry).",
|
|
224
|
-
},
|
|
225
|
-
{
|
|
226
|
-
element_type: "phase",
|
|
227
|
-
type_name: "task_binding",
|
|
228
|
-
semantic_explanation: "One-time task_set (222). E_TASK_ALREADY_SET on any retry.",
|
|
229
|
-
},
|
|
230
|
-
{
|
|
231
|
-
element_type: "phase",
|
|
232
|
-
type_name: "forward_advance",
|
|
233
|
-
semantic_explanation: "Dynamic permission: IsNamedOperator OR Forward.permissionIndex OR Forward.guard (Passport). NOT 220-225.",
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
element_type: "phase",
|
|
237
|
-
type_name: "completed",
|
|
238
|
-
semantic_explanation: "session.weights ≥ threshold → push to history, current = next_node. Atomic.",
|
|
239
|
-
},
|
|
240
|
-
];
|
|
241
|
-
export const PROGRESS_CONSTRAINT_RULES = [
|
|
242
|
-
{
|
|
243
|
-
id: "MC-PR-01",
|
|
244
|
-
category: "structural",
|
|
245
|
-
rule: "Machine must be published before Progress creation (machine::on_progress_new asserts published state)",
|
|
246
|
-
applies_to: ["creation"],
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
id: "MC-PR-02",
|
|
250
|
-
category: "structural",
|
|
251
|
-
rule: "Progress.machine is immutable after creation (E_MACHINE_NOT_MATCH on every op)",
|
|
252
|
-
applies_to: ["operate", "task", "repository", "progress_namedOperator"],
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
id: "MC-PR-03",
|
|
256
|
-
category: "structural",
|
|
257
|
-
rule: "named_operator count < MAX_NAMED_OPERATOR_COUNT (60); E_MAX_NAMED_OPERATOR_COUNT on overflow",
|
|
258
|
-
applies_to: ["progress_namedOperator.op=add (new name)"],
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
id: "MC-PR-04",
|
|
262
|
-
category: "structural",
|
|
263
|
-
rule: "named_operator addresses < MAX_NAMED_OPERATOR_ADDRESS_COUNT (80); E_MAX_NAMED_OPERATOR_ADDRESS_COUNT on overflow",
|
|
264
|
-
applies_to: ["progress_namedOperator.operators"],
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
id: "MC-PR-05",
|
|
268
|
-
category: "structural",
|
|
269
|
-
rule: "context_repository count < MAX_CONTEXT_REPOSITORY_COUNT (30); E_MAX_CONTEXT_REPOSITORY_COUNT on overflow",
|
|
270
|
-
applies_to: ["repository.op=add", "repository.op=set"],
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
id: "MC-PR-06",
|
|
274
|
-
category: "semantic",
|
|
275
|
-
rule: "task_set is one-time: E_TASK_ALREADY_SET blocks any re-assignment",
|
|
276
|
-
applies_to: ["task"],
|
|
277
|
-
},
|
|
278
|
-
{
|
|
279
|
-
id: "MC-PR-07",
|
|
280
|
-
category: "semantic",
|
|
281
|
-
rule: "operate.op must be one of: next | hold | unhold | adminUnhold (schema-enforced enum)",
|
|
282
|
-
applies_to: ["operate.op"],
|
|
283
|
-
},
|
|
284
|
-
{
|
|
285
|
-
id: "MC-PR-08",
|
|
286
|
-
category: "semantic",
|
|
287
|
-
rule: "operate.message must satisfy common::LONG_NAME (≤ MAX_LONG_NAME_LENGTH)",
|
|
288
|
-
applies_to: ["operate.message"],
|
|
289
|
-
},
|
|
290
|
-
{
|
|
291
|
-
id: "MC-PR-09",
|
|
292
|
-
category: "permission",
|
|
293
|
-
rule: "Forward advance uses DYNAMIC permission: namedOperator OR Forward.permissionIndex OR Forward.guard — NOT 220-225",
|
|
294
|
-
applies_to: ["operate (next/hold/unhold)"],
|
|
295
|
-
},
|
|
296
|
-
{
|
|
297
|
-
id: "MC-PR-10",
|
|
298
|
-
category: "permission",
|
|
299
|
-
rule: "220-225 builtin indexes are MANAGEMENT-ONLY (named_operator/task/repository/unhold/owner_receive)",
|
|
300
|
-
applies_to: ["progress_namedOperator", "task", "repository", "operate.op='adminUnhold'"],
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
id: "MC-PR-11",
|
|
304
|
-
category: "permission",
|
|
305
|
-
rule: "adminUnhold (224) bypasses holder check — grant only to dedicated recovery addresses",
|
|
306
|
-
applies_to: ["operate.op='adminUnhold'"],
|
|
307
|
-
},
|
|
308
|
-
{
|
|
309
|
-
id: "MC-PR-12",
|
|
310
|
-
category: "lifecycle",
|
|
311
|
-
rule: "Forward already accomplished → E_FORWARD_ALREADY_ACCOMPLISHED on re-hold (idempotent completion)",
|
|
312
|
-
applies_to: ["operate.op='hold'"],
|
|
313
|
-
},
|
|
314
|
-
{
|
|
315
|
-
id: "MC-PR-13",
|
|
316
|
-
category: "lifecycle",
|
|
317
|
-
rule: "unhold by non-holder requires 224 permission; else E_NOT_THE_HOLDER",
|
|
318
|
-
applies_to: ["operate.op='unhold'"],
|
|
319
|
-
},
|
|
320
|
-
{
|
|
321
|
-
id: "MC-PR-14",
|
|
322
|
-
category: "cross_object",
|
|
323
|
-
rule: "order_next/order_hold require progress.task == order address (E_ORDER_NOT_MATCH)",
|
|
324
|
-
applies_to: ["operate (order variant)"],
|
|
325
|
-
},
|
|
326
|
-
{
|
|
327
|
-
id: "MC-PR-15",
|
|
328
|
-
category: "cross_object",
|
|
329
|
-
rule: "context_repository_add creates Registrar affiliation — remove before deleting Repository",
|
|
330
|
-
applies_to: ["repository.op=add"],
|
|
331
|
-
},
|
|
332
|
-
{
|
|
333
|
-
id: "MC-PR-16",
|
|
334
|
-
category: "cross_object",
|
|
335
|
-
rule: "Forward.guard (Some) requires *_with_passport variant; plain next() aborts E_NEED_PASSPORT",
|
|
336
|
-
applies_to: ["operate (guarded forward)"],
|
|
337
|
-
},
|
|
338
|
-
];
|
|
339
|
-
export const PROGRESS_TRANSLATION_VERSION = "1.0.0";
|
|
340
|
-
export function matchSemanticPattern(userIntent) {
|
|
341
|
-
const lower = userIntent.toLowerCase();
|
|
342
|
-
return PROGRESS_SEMANTIC_TO_SCHEMA_RULES.filter(rule => rule.match_keywords.some(kw => lower.includes(kw.toLowerCase())));
|
|
343
|
-
}
|
|
344
|
-
export function explainProgressCallData(data) {
|
|
345
|
-
const lines = [];
|
|
346
|
-
if (!data.object) {
|
|
347
|
-
lines.push("Operation: CREATE Progress (indirect — service::buy → new_imp)");
|
|
348
|
-
}
|
|
349
|
-
else {
|
|
350
|
-
lines.push(`Operation: OPERATE Progress at ${data.object}`);
|
|
351
|
-
}
|
|
352
|
-
if (data.task) {
|
|
353
|
-
lines.push(`- ⚠️ task_set: ${data.task} (one-time, immutable — E_TASK_ALREADY_SET on re-set)`);
|
|
354
|
-
}
|
|
355
|
-
if (data.repository) {
|
|
356
|
-
const r = data.repository;
|
|
357
|
-
const objCount = r.objects?.length ?? 0;
|
|
358
|
-
lines.push(`- Repository ${r.op}: ${objCount} object(s)`);
|
|
359
|
-
}
|
|
360
|
-
if (data.progress_namedOperator) {
|
|
361
|
-
const n = data.progress_namedOperator;
|
|
362
|
-
const opCount = n.operators?.length ?? 0;
|
|
363
|
-
const nameDisplay = n.name === "" ? "(OrderHolder namespace)" : `"${n.name}"`;
|
|
364
|
-
lines.push(`- namedOperator ${n.op} ${nameDisplay}: ${opCount} address(es)`);
|
|
365
|
-
}
|
|
366
|
-
if (data.operate) {
|
|
367
|
-
const o = data.operate;
|
|
368
|
-
lines.push(`- Operation: ${o.operation.forward} → ${o.operation.next_node_name}`);
|
|
369
|
-
if (o.op) {
|
|
370
|
-
lines.push(` op=${o.op}`);
|
|
371
|
-
}
|
|
372
|
-
if (o.op === "hold") {
|
|
373
|
-
lines.push(` ⚠️ hold: lock this forward (Holder.who = sender)`);
|
|
374
|
-
}
|
|
375
|
-
else if (o.op === "adminUnhold") {
|
|
376
|
-
lines.push(` ⚠️ adminUnhold: force release via 224 permission (bypasses holder check)`);
|
|
377
|
-
}
|
|
378
|
-
else if (o.op === "unhold") {
|
|
379
|
-
lines.push(` ℹ️ unhold: self-release own hold (sender must == Holder.who)`);
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
lines.push(` Submit result (advance forward, accumulate weight toward threshold)`);
|
|
383
|
-
}
|
|
384
|
-
if (o.message) {
|
|
385
|
-
lines.push(` Message: "${o.message}"`);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
return lines.join("\n");
|
|
389
|
-
}
|
|
390
|
-
export function explainField(fieldName) {
|
|
391
|
-
return PROGRESS_SCHEMA_TO_SEMANTIC_RULES.find(r => r.element_type === "field" && r.type_name === fieldName);
|
|
392
|
-
}
|
|
393
|
-
export function explainOp(opName) {
|
|
394
|
-
return PROGRESS_SCHEMA_TO_SEMANTIC_RULES.find(r => r.element_type === "op" && r.type_name === opName);
|
|
395
|
-
}
|
|
396
|
-
export function getConstraintsByCategory(category) {
|
|
397
|
-
return PROGRESS_CONSTRAINT_RULES.filter(r => r.category === category);
|
|
398
|
-
}
|
|
399
|
-
export function explainPermissionIndex(index) {
|
|
400
|
-
if (isProgressBuiltinPermission(index)) {
|
|
401
|
-
const entry = getBuiltinPermissionByIndex(index);
|
|
402
|
-
return `${entry.name} (${index}) — ${entry.description}`;
|
|
403
|
-
}
|
|
404
|
-
return `Custom/dynamic permission index (${index}) — resolved via Forward.permissionIndex in Machine`;
|
|
405
|
-
}
|
|
1
|
+
import{isProgressBuiltinPermission,getBuiltinPermissionByIndex}from'./progress-ledger.js';export const PROGRESS_SEMANTIC_TO_SCHEMA_RULES=[{'id':'P-PR-01','pattern_name':'Advance\x20Progress\x20(next\x20/\x20order_next)','semantic_intent':'Push\x20Progress\x20forward\x20via\x20a\x20Forward\x20definition;\x20accumulate\x20weight,\x20possibly\x20complete\x20session','match_keywords':['next','advance','proceed','complete\x20forward'],'schema_fields':['object','operate(operation,\x20op=\x27next\x27)'],'example_json':{'object':'0xPROGRESS_ADDRESS','operate':{'operation':{'next_node_name':'shipped','forward':'ship'},'op':'next','message':'Order\x20shipped\x20via\x20FedEx,\x20tracking\x2012345'}},'reverse_explanation':'operate.op=\x27next\x27\x20→\x20calls\x20progress::next\x20or\x20order_next\x20(if\x20task\x20bound).\x20'+'Move\x20accumulates\x20forward.weight;\x20on\x20reaching\x20threshold,\x20session\x20→\x20history\x20and\x20current\x20=\x20next_node_name.\x20'+'⚠\x20ROUTING\x20RULE:\x20When\x20Forward.namedOperator=\x22\x22\x20(empty\x20string\x20=\x20OrderHolder),\x20the\x20caller\x20MUST\x20use\x20'+'order.progress\x20(not\x20progress.operate)\x20—\x20order_next\x20uses\x20order.has_op_permission\x20which\x20recognizes\x20'+'the\x20OrderHolder\x20short-circuit.\x20Direct\x20progress::next\x20will\x20abort\x20with\x20\x27Permission\x20denied\x27\x20(code\x205).\x20'+'For\x20non-empty\x20namedOperator\x20or\x20permissionIndex-only\x20forwards,\x20use\x20progress.operate\x20directly.'},{'id':'P-PR-02','pattern_name':'Hold\x20Progress\x20(block\x20forward)','semantic_intent':'Lock\x20a\x20Forward\x20so\x20no\x20one\x20else\x20can\x20advance\x20it\x20until\x20unhold','match_keywords':['hold','lock','block','pause\x20forward'],'schema_fields':['object','operate(operation,\x20op=\x27hold\x27,\x20message)'],'example_json':{'object':'0xPROGRESS_ADDRESS','operate':{'operation':{'next_node_name':'revision_required','forward':'request_revision'},'op':'hold','message':'Please\x20revise\x20section\x203'}},'reverse_explanation':'operate.op=\x27hold\x27\x20→\x20calls\x20progress::hold\x20or\x20order_hold.\x20session_hold\x20sets\x20Holder.who\x20=\x20sender;\x20'+'other\x20callers\x20will\x20hit\x20E_NOT_THE_HOLDER\x20if\x20they\x20try\x20to\x20advance.'},{'id':'P-PR-03','pattern_name':'Self-unhold\x20(release\x20own\x20hold)','semantic_intent':'Release\x20a\x20forward\x20that\x20I\x20previously\x20held','match_keywords':['unhold','release','self\x20release'],'schema_fields':['object','operate(operation,\x20op=\x27unhold\x27)'],'example_json':{'object':'0xPROGRESS_ADDRESS','operate':{'operation':{'next_node_name':'reviewing','forward':'resubmit'},'op':'unhold','message':'Revised\x20content\x20uploaded'}},'reverse_explanation':'operate.op=\x27unhold\x27\x20→\x20calls\x20progress::hold(bHold=false)\x20or\x20order_hold(bHold=false).\x20'+'Move\x27s\x20session_hold\x20releases\x20the\x20lock\x20(sender\x20==\x20Holder.who).\x20'+'After\x20release,\x20the\x20forward\x20can\x20be\x20re-locked\x20or\x20accomplished\x20by\x20eligible\x20callers.'},{'id':'P-PR-04','pattern_name':'Admin\x20force-unhold\x20(224\x20permission)','semantic_intent':'Force-release\x20a\x20held\x20forward\x20using\x20224\x20permission,\x20bypassing\x20holder\x20check','match_keywords':['adminUnhold','force\x20unhold','admin\x20release'],'schema_fields':['object','operate(operation,\x20op=\x27adminUnhold\x27)'],'example_json':{'object':'0xPROGRESS_ADDRESS','operate':{'operation':{'next_node_name':'arb_decided','forward':'decide'},'op':'adminUnhold','message':'Admin\x20override:\x20holder\x20unresponsive\x20for\x207\x20days'}},'reverse_explanation':'operate.op=\x27adminUnhold\x27\x20→\x20calls\x20progress::unhold.\x20Move\x20checks\x20sender_has_permission_idcheck(224);\x20'+'if\x20true,\x20force\x20release\x20(bForce=true).\x20If\x20false,\x20falls\x20back\x20to\x20holder-match\x20check.'},{'id':'P-PR-05','pattern_name':'Bind\x20task\x20(one-time,\x20immutable)','semantic_intent':'Associate\x20an\x20Order/Reward\x20address\x20with\x20this\x20Progress\x20(only\x20once\x20per\x20Progress)','match_keywords':['task_set','bind\x20task','set\x20task'],'schema_fields':['object','task'],'example_json':{'object':'0xPROGRESS_ADDRESS','task':'0xORDER_ADDRESS'},'reverse_explanation':'Calls\x20progress::task_set.\x20Move\x20asserts\x20option::is_none(&self.task);\x20if\x20already\x20set,\x20E_TASK_ALREADY_SET\x20aborts.\x20'+'There\x20is\x20NO\x20task_unset\x20—\x20once\x20bound,\x20the\x20Progress\x20is\x20permanently\x20tied\x20to\x20that\x20Order/Reward.'},{'id':'P-PR-06','pattern_name':'Manage\x20context\x20repositories','semantic_intent':'Add/remove/clear\x20Repository\x20objects\x20as\x20query\x20context\x20(≤\x2030\x20total)','match_keywords':['repository','context'],'schema_fields':['object','repository(op,\x20objects)'],'example_json':{'object':'0xPROGRESS_ADDRESS','repository':{'op':'add','objects':['0xREPO1','0xREPO2']}},'reverse_explanation':'op=add:\x20appends\x20(idempotent\x20via\x20vector::contains).\x20op=remove:\x20drops\x20listed\x20addresses.\x20'+'op=clear:\x20empties\x20the\x20list.\x20op=set:\x20clears\x20then\x20adds.\x20Count\x20must\x20stay\x20≤\x20MAX_CONTEXT_REPOSITORY_COUNT\x20(30).'},{'id':'P-PR-07','pattern_name':'Manage\x20named_operator\x20namespace','semantic_intent':'Add/set/remove\x20addresses\x20for\x20a\x20named\x20operator\x20role\x20(Forward\x20gate)','match_keywords':['named_operator','operator'],'schema_fields':['object','progress_namedOperator(op,\x20name,\x20operators)'],'example_json':{'object':'0xPROGRESS_ADDRESS','progress_namedOperator':{'op':'add','name':'logistics','operators':['0xADDR1','0xADDR2']}},'reverse_explanation':'op=add:\x20appends\x20(deduped).\x20op=set:\x20REPLACES\x20the\x20address\x20list.\x20op=remove:\x20drops\x20listed\x20addresses.\x20'+'Up\x20to\x2060\x20named_operator\x20names\x20per\x20Progress;\x20up\x20to\x2080\x20addresses\x20per\x20name.'},{'id':'P-PR-08','pattern_name':'Owner\x20receive\x20(terminal\x20node\x20unwrap)','semantic_intent':'Owner\x20receives\x20Receiving<K>\x20objects\x20or\x20CoinWrapper<T>\x20coins\x20at\x20a\x20terminal\x20node','match_keywords':['owner_receive','unwrap','withdraw'],'schema_fields':['(SDK\x20does\x20not\x20expose\x20this\x20in\x20CallProgress_Data\x20—\x20direct\x20move\x20call\x20required)'],'example_json':{'_note':'Not\x20exposed\x20in\x20CallProgress_Data;\x20direct\x20Move\x20call:','target':'progress::owner_receive<T>','arguments':['progress','machine','permission','received','payment']},'reverse_explanation':'Calls\x20progress::owner_receive\x20(225\x20permission).\x20Unwraps\x20CoinWrapper<T>\x20via\x20Payment.unwrap_with_check,\x20'+'forwards\x20coin/object\x20to\x20Permission\x20owner.\x20Typically\x20triggered\x20at\x20terminal\x20nodes\x20(return_approved,\x20completed,\x20enforced).'}];export const PROGRESS_SCHEMA_TO_SEMANTIC_RULES=[{'element_type':'field','type_name':'object','semantic_explanation':'Progress\x20object\x20address.\x20Always\x20required\x20for\x20operate\x20calls\x20(Progress\x20is\x20created\x20indirectly\x20via\x20service::buy).'},{'element_type':'field','type_name':'task','semantic_explanation':'Bind\x20a\x20task\x20(Order/Reward)\x20address.\x20ONE-TIME\x20only\x20—\x20E_TASK_ALREADY_SET\x20on\x20re-set.'},{'element_type':'field','type_name':'repository','semantic_explanation':'Context\x20Repository\x20list\x20management.\x20op=add/set/remove/clear.\x20Total\x20≤\x20MAX_CONTEXT_REPOSITORY_COUNT\x20(30).'},{'element_type':'field','type_name':'progress_namedOperator','semantic_explanation':'named_operator\x20namespace\x20management.\x20name=\x27\x27\x20is\x20the\x20OrderHolder\x20special\x20namespace.\x20≤\x2060\x20names,\x20≤\x2080\x20addresses\x20each.'},{'element_type':'field','type_name':'operate','semantic_explanation':'Forward\x20advancement\x20/\x20hold\x20/\x20unhold.\x20Contains\x20operation\x20(next_node_name\x20+\x20forward)\x20and\x20hold/adminUnhold/message\x20flags.'},{'element_type':'field','type_name':'operate.operation.next_node_name','semantic_explanation':'Target\x20node\x20name.\x20Must\x20exist\x20in\x20Machine\x20and\x20be\x20reachable\x20from\x20current\x20via\x20a\x20Forward\x20definition.'},{'element_type':'field','type_name':'operate.operation.forward','semantic_explanation':'Forward\x20name.\x20Must\x20be\x20one\x20of\x20the\x20forwards\x20defined\x20from\x20current\x20→\x20next_node_name\x20in\x20the\x20Machine.'},{'element_type':'field','type_name':'operate.op','semantic_explanation':'Operation\x20type:\x20\x27next\x27\x20=\x20advance\x20forward;\x20\x27hold\x27\x20=\x20lock\x20forward\x20(Holder.who\x20=\x20sender);\x20\x27unhold\x27\x20=\x20self-release\x20own\x20hold;\x20\x27adminUnhold\x27\x20=\x20force\x20release\x20via\x20224\x20permission\x20(bypasses\x20holder\x20check).'},{'element_type':'field','type_name':'operate.message','semantic_explanation':'Deliverable\x20message\x20(≤\x20MAX_LONG_NAME_LENGTH).\x20Stored\x20in\x20Holder.msg\x20/\x20delivered\x20on\x20accomplishment.'},{'element_type':'op','type_name':'next','semantic_explanation':'Plain\x20forward\x20advance.\x20Use\x20when\x20no\x20bound\x20Order,\x20OR\x20caller\x20is\x20named_operator\x20(not\x20OrderHolder).'},{'element_type':'op','type_name':'order_next','semantic_explanation':'Order-bound\x20forward\x20advance.\x20Caller\x20must\x20satisfy\x20order.has_op_permission\x20(order\x20owner/agent).'},{'element_type':'op','type_name':'hold','semantic_explanation':'Lock\x20forward.\x20Holder.who\x20=\x20sender;\x20subsequent\x20callers\x20hit\x20E_NOT_THE_HOLDER.'},{'element_type':'op','type_name':'order_hold','semantic_explanation':'Order-bound\x20hold.\x20Same\x20as\x20hold\x20but\x20uses\x20order.has_op_permission\x20for\x20OrderHolder\x20verification.'},{'element_type':'op','type_name':'unhold','semantic_explanation':'Self-release\x20(sender\x20==\x20Holder.who)\x20OR\x20admin\x20force-release\x20(224\x20permission).'},{'element_type':'op','type_name':'namedOperator_add','semantic_explanation':'Append\x20addresses\x20to\x20a\x20named_operator\x20(deduped;\x20fails\x20if\x20name\x20new\x20and\x20≥\x2060\x20names).'},{'element_type':'op','type_name':'namedOperator_set','semantic_explanation':'REPLACE\x20the\x20address\x20list\x20for\x20a\x20named_operator\x20name\x20(or\x20create\x20if\x20name\x20new).'},{'element_type':'op','type_name':'namedOperator_remove','semantic_explanation':'Drop\x20listed\x20addresses\x20from\x20a\x20named_operator\x20name\x20(no-op\x20if\x20name\x20doesn\x27t\x20exist).'},{'element_type':'phase','type_name':'creation','semantic_explanation':'Indirect:\x20service::buy\x20→\x20progress::new_imp\x20(bypasses\x20220\x20assertion\x20via\x20package-internal\x20entry).'},{'element_type':'phase','type_name':'task_binding','semantic_explanation':'One-time\x20task_set\x20(222).\x20E_TASK_ALREADY_SET\x20on\x20any\x20retry.'},{'element_type':'phase','type_name':'forward_advance','semantic_explanation':'Dynamic\x20permission:\x20IsNamedOperator\x20OR\x20Forward.permissionIndex\x20OR\x20Forward.guard\x20(Passport).\x20NOT\x20220-225.'},{'element_type':'phase','type_name':'completed','semantic_explanation':'session.weights\x20≥\x20threshold\x20→\x20push\x20to\x20history,\x20current\x20=\x20next_node.\x20Atomic.'}];export const PROGRESS_CONSTRAINT_RULES=[{'id':'MC-PR-01','category':'structural','rule':'Machine\x20must\x20be\x20published\x20before\x20Progress\x20creation\x20(machine::on_progress_new\x20asserts\x20published\x20state)','applies_to':['creation']},{'id':'MC-PR-02','category':'structural','rule':'Progress.machine\x20is\x20immutable\x20after\x20creation\x20(E_MACHINE_NOT_MATCH\x20on\x20every\x20op)','applies_to':['operate','task','repository','progress_namedOperator']},{'id':'MC-PR-03','category':'structural','rule':'named_operator\x20count\x20<\x20MAX_NAMED_OPERATOR_COUNT\x20(60);\x20E_MAX_NAMED_OPERATOR_COUNT\x20on\x20overflow','applies_to':['progress_namedOperator.op=add\x20(new\x20name)']},{'id':'MC-PR-04','category':'structural','rule':'named_operator\x20addresses\x20<\x20MAX_NAMED_OPERATOR_ADDRESS_COUNT\x20(80);\x20E_MAX_NAMED_OPERATOR_ADDRESS_COUNT\x20on\x20overflow','applies_to':['progress_namedOperator.operators']},{'id':'MC-PR-05','category':'structural','rule':'context_repository\x20count\x20<\x20MAX_CONTEXT_REPOSITORY_COUNT\x20(30);\x20E_MAX_CONTEXT_REPOSITORY_COUNT\x20on\x20overflow','applies_to':['repository.op=add','repository.op=set']},{'id':'MC-PR-06','category':'semantic','rule':'task_set\x20is\x20one-time:\x20E_TASK_ALREADY_SET\x20blocks\x20any\x20re-assignment','applies_to':['task']},{'id':'MC-PR-07','category':'semantic','rule':'operate.op\x20must\x20be\x20one\x20of:\x20next\x20|\x20hold\x20|\x20unhold\x20|\x20adminUnhold\x20(schema-enforced\x20enum)','applies_to':['operate.op']},{'id':'MC-PR-08','category':'semantic','rule':'operate.message\x20must\x20satisfy\x20common::LONG_NAME\x20(≤\x20MAX_LONG_NAME_LENGTH)','applies_to':['operate.message']},{'id':'MC-PR-09','category':'permission','rule':'Forward\x20advance\x20uses\x20DYNAMIC\x20permission:\x20namedOperator\x20OR\x20Forward.permissionIndex\x20OR\x20Forward.guard\x20—\x20NOT\x20220-225','applies_to':['operate\x20(next/hold/unhold)']},{'id':'MC-PR-10','category':'permission','rule':'220-225\x20builtin\x20indexes\x20are\x20MANAGEMENT-ONLY\x20(named_operator/task/repository/unhold/owner_receive)','applies_to':['progress_namedOperator','task','repository','operate.op=\x27adminUnhold\x27']},{'id':'MC-PR-11','category':'permission','rule':'adminUnhold\x20(224)\x20bypasses\x20holder\x20check\x20—\x20grant\x20only\x20to\x20dedicated\x20recovery\x20addresses','applies_to':['operate.op=\x27adminUnhold\x27']},{'id':'MC-PR-12','category':'lifecycle','rule':'Forward\x20already\x20accomplished\x20→\x20E_FORWARD_ALREADY_ACCOMPLISHED\x20on\x20re-hold\x20(idempotent\x20completion)','applies_to':['operate.op=\x27hold\x27']},{'id':'MC-PR-13','category':'lifecycle','rule':'unhold\x20by\x20non-holder\x20requires\x20224\x20permission;\x20else\x20E_NOT_THE_HOLDER','applies_to':['operate.op=\x27unhold\x27']},{'id':'MC-PR-14','category':'cross_object','rule':'order_next/order_hold\x20require\x20progress.task\x20==\x20order\x20address\x20(E_ORDER_NOT_MATCH)','applies_to':['operate\x20(order\x20variant)']},{'id':'MC-PR-15','category':'cross_object','rule':'context_repository_add\x20creates\x20Registrar\x20affiliation\x20—\x20remove\x20before\x20deleting\x20Repository','applies_to':['repository.op=add']},{'id':'MC-PR-16','category':'cross_object','rule':'Forward.guard\x20(Some)\x20requires\x20*_with_passport\x20variant;\x20plain\x20next()\x20aborts\x20E_NEED_PASSPORT','applies_to':['operate\x20(guarded\x20forward)']}];export const PROGRESS_TRANSLATION_VERSION='1.0.0';export function matchSemanticPattern(a){const b=a['toLowerCase']();return PROGRESS_SEMANTIC_TO_SCHEMA_RULES['filter'](c=>c['match_keywords']['some'](d=>b['includes'](d['toLowerCase']())));}export function explainProgressCallData(a){const b=[];!a['object']?b['push']('Operation:\x20CREATE\x20Progress\x20(indirect\x20—\x20service::buy\x20→\x20new_imp)'):b['push']('Operation:\x20OPERATE\x20Progress\x20at\x20'+a['object']);a['task']&&b['push']('-\x20⚠️\x20task_set:\x20'+a['task']+'\x20(one-time,\x20immutable\x20—\x20E_TASK_ALREADY_SET\x20on\x20re-set)');if(a['repository']){const c=a['repository'],d=c['objects']?.['length']??0x0;b['push']('-\x20Repository\x20'+c['op']+':\x20'+d+'\x20object(s)');}if(a['progress_namedOperator']){const e=a['progress_namedOperator'],f=e['operators']?.['length']??0x0,g=e['name']===''?'(OrderHolder\x20namespace)':'\x22'+e['name']+'\x22';b['push']('-\x20namedOperator\x20'+e['op']+'\x20'+g+':\x20'+f+'\x20address(es)');}if(a['operate']){const h=a['operate'];b['push']('-\x20Operation:\x20'+h['operation']['forward']+'\x20→\x20'+h['operation']['next_node_name']);h['op']&&b['push']('\x20\x20op='+h['op']);if(h['op']==='hold')b['push']('\x20\x20⚠️\x20hold:\x20lock\x20this\x20forward\x20(Holder.who\x20=\x20sender)');else{if(h['op']==='adminUnhold')b['push']('\x20\x20⚠️\x20adminUnhold:\x20force\x20release\x20via\x20224\x20permission\x20(bypasses\x20holder\x20check)');else h['op']==='unhold'?b['push']('\x20\x20ℹ️\x20unhold:\x20self-release\x20own\x20hold\x20(sender\x20must\x20==\x20Holder.who)'):b['push']('\x20\x20Submit\x20result\x20(advance\x20forward,\x20accumulate\x20weight\x20toward\x20threshold)');}h['message']&&b['push']('\x20\x20Message:\x20\x22'+h['message']+'\x22');}return b['join']('\x0a');}export function explainField(a){return PROGRESS_SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='field'&&b['type_name']===a);}export function explainOp(a){return PROGRESS_SCHEMA_TO_SEMANTIC_RULES['find'](b=>b['element_type']==='op'&&b['type_name']===a);}export function getConstraintsByCategory(a){return PROGRESS_CONSTRAINT_RULES['filter'](b=>b['category']===a);}export function explainPermissionIndex(a){if(isProgressBuiltinPermission(a)){const b=getBuiltinPermissionByIndex(a);return b['name']+'\x20('+a+')\x20—\x20'+b['description'];}return'Custom/dynamic\x20permission\x20index\x20('+a+')\x20—\x20resolved\x20via\x20Forward.permissionIndex\x20in\x20Machine';}
|