@wowok/agent-mcp 2.4.3 → 2.5.0
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/runtime.d.ts +4 -0
- package/dist/config/runtime.js +29 -5
- package/dist/harness/auto-escalation.d.ts +27 -0
- package/dist/harness/auto-escalation.js +68 -0
- package/dist/index.js +21 -0
- package/dist/knowledge/allocation-confirm.d.ts +115 -0
- package/dist/knowledge/allocation-confirm.js +534 -0
- package/dist/knowledge/allocation-context.d.ts +58 -0
- package/dist/knowledge/allocation-context.js +249 -0
- package/dist/knowledge/allocation-ledger.d.ts +67 -0
- package/dist/knowledge/allocation-ledger.js +463 -0
- package/dist/knowledge/allocation-puzzle.d.ts +135 -0
- package/dist/knowledge/allocation-puzzle.js +298 -0
- package/dist/knowledge/allocation-risk.d.ts +78 -0
- package/dist/knowledge/allocation-risk.js +568 -0
- package/dist/knowledge/allocation-templates.d.ts +38 -0
- package/dist/knowledge/allocation-templates.js +970 -0
- package/dist/knowledge/allocation-translation.d.ts +72 -0
- package/dist/knowledge/allocation-translation.js +585 -0
- package/dist/knowledge/arb-risk.d.ts +37 -0
- package/dist/knowledge/arb-risk.js +210 -0
- package/dist/knowledge/arbitration-confirm.d.ts +135 -0
- package/dist/knowledge/arbitration-confirm.js +559 -0
- package/dist/knowledge/arbitration-context.d.ts +81 -0
- package/dist/knowledge/arbitration-context.js +505 -0
- package/dist/knowledge/arbitration-ledger.d.ts +62 -0
- package/dist/knowledge/arbitration-ledger.js +521 -0
- package/dist/knowledge/arbitration-puzzle.d.ts +84 -0
- package/dist/knowledge/arbitration-puzzle.js +304 -0
- package/dist/knowledge/arbitration-risk.d.ts +112 -0
- package/dist/knowledge/arbitration-risk.js +433 -0
- package/dist/knowledge/arbitration-templates.d.ts +38 -0
- package/dist/knowledge/arbitration-templates.js +276 -0
- package/dist/knowledge/arbitration-translation.d.ts +91 -0
- package/dist/knowledge/arbitration-translation.js +487 -0
- package/dist/knowledge/bridge-risk.d.ts +36 -0
- package/dist/knowledge/bridge-risk.js +263 -0
- package/dist/knowledge/contact-risk.d.ts +32 -0
- package/dist/knowledge/contact-risk.js +200 -0
- package/dist/knowledge/demand-confirm.d.ts +32 -0
- package/dist/knowledge/demand-confirm.js +206 -0
- package/dist/knowledge/demand-risk.d.ts +30 -0
- package/dist/knowledge/demand-risk.js +240 -0
- package/dist/knowledge/demand-translation.d.ts +55 -0
- package/dist/knowledge/demand-translation.js +354 -0
- package/dist/knowledge/deployment-scanner.d.ts +63 -0
- package/dist/knowledge/deployment-scanner.js +762 -0
- package/dist/knowledge/examples-scanner-cli.d.ts +1 -0
- package/dist/knowledge/examples-scanner-cli.js +26 -0
- package/dist/knowledge/examples-scanner.d.ts +121 -0
- package/dist/knowledge/examples-scanner.js +825 -0
- package/dist/knowledge/flywheel-loop.d.ts +3 -0
- package/dist/knowledge/flywheel-loop.js +32 -3
- package/dist/knowledge/glossary.js +3 -1
- package/dist/knowledge/guard-confirm.d.ts +86 -0
- package/dist/knowledge/guard-confirm.js +406 -0
- package/dist/knowledge/guard-context.d.ts +56 -0
- package/dist/knowledge/guard-context.js +287 -0
- package/dist/knowledge/guard-design-patterns.d.ts +37 -0
- package/dist/knowledge/guard-design-patterns.js +257 -0
- package/dist/knowledge/guard-puzzle.js +3 -2
- package/dist/knowledge/guard-risk.d.ts +1 -1
- package/dist/knowledge/guard-risk.js +12 -14
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/guard-translation.js +6 -5
- package/dist/knowledge/index.d.ts +342 -0
- package/dist/knowledge/index.js +344 -0
- package/dist/knowledge/machine-confirm.d.ts +102 -0
- package/dist/knowledge/machine-confirm.js +559 -0
- package/dist/knowledge/machine-context.d.ts +160 -0
- package/dist/knowledge/machine-context.js +812 -0
- package/dist/knowledge/machine-ledger.d.ts +41 -0
- package/dist/knowledge/machine-ledger.js +315 -0
- package/dist/knowledge/machine-puzzle.d.ts +206 -0
- package/dist/knowledge/machine-puzzle.js +494 -0
- package/dist/knowledge/machine-risk.d.ts +75 -0
- package/dist/knowledge/machine-risk.js +644 -0
- package/dist/knowledge/machine-templates.d.ts +92 -0
- package/dist/knowledge/machine-templates.js +1592 -0
- package/dist/knowledge/machine-topology.d.ts +57 -0
- package/dist/knowledge/machine-topology.js +234 -0
- package/dist/knowledge/machine-translation.d.ts +96 -0
- package/dist/knowledge/machine-translation.js +513 -0
- package/dist/knowledge/mcp-schema-audit-cli.d.ts +1 -0
- package/dist/knowledge/mcp-schema-audit-cli.js +45 -0
- package/dist/knowledge/mcp-schema-audit.d.ts +90 -0
- package/dist/knowledge/mcp-schema-audit.js +772 -0
- package/dist/knowledge/onchain-constants.d.ts +4 -0
- package/dist/knowledge/onchain-constants.js +35 -0
- package/dist/knowledge/order-confirm.d.ts +115 -0
- package/dist/knowledge/order-confirm.js +573 -0
- package/dist/knowledge/order-context.d.ts +66 -0
- package/dist/knowledge/order-context.js +390 -0
- package/dist/knowledge/order-ledger.d.ts +69 -0
- package/dist/knowledge/order-ledger.js +341 -0
- package/dist/knowledge/order-puzzle.d.ts +159 -0
- package/dist/knowledge/order-puzzle.js +255 -0
- package/dist/knowledge/order-risk.d.ts +66 -0
- package/dist/knowledge/order-risk.js +653 -0
- package/dist/knowledge/order-templates.d.ts +50 -0
- package/dist/knowledge/order-templates.js +368 -0
- package/dist/knowledge/order-translation.d.ts +78 -0
- package/dist/knowledge/order-translation.js +550 -0
- package/dist/knowledge/passport-confirm.d.ts +130 -0
- package/dist/knowledge/passport-confirm.js +531 -0
- package/dist/knowledge/passport-context.d.ts +59 -0
- package/dist/knowledge/passport-context.js +306 -0
- package/dist/knowledge/passport-ledger.d.ts +48 -0
- package/dist/knowledge/passport-ledger.js +282 -0
- package/dist/knowledge/passport-puzzle.d.ts +108 -0
- package/dist/knowledge/passport-puzzle.js +333 -0
- package/dist/knowledge/passport-risk.d.ts +70 -0
- package/dist/knowledge/passport-risk.js +450 -0
- package/dist/knowledge/passport-templates.d.ts +40 -0
- package/dist/knowledge/passport-templates.js +568 -0
- package/dist/knowledge/passport-translation.d.ts +68 -0
- package/dist/knowledge/passport-translation.js +516 -0
- package/dist/knowledge/payment-risk.d.ts +33 -0
- package/dist/knowledge/payment-risk.js +182 -0
- package/dist/knowledge/permission-confirm.d.ts +110 -0
- package/dist/knowledge/permission-confirm.js +426 -0
- package/dist/knowledge/permission-context.d.ts +58 -0
- package/dist/knowledge/permission-context.js +224 -0
- package/dist/knowledge/permission-ledger.d.ts +38 -0
- package/dist/knowledge/permission-ledger.js +403 -0
- package/dist/knowledge/permission-puzzle.d.ts +122 -0
- package/dist/knowledge/permission-puzzle.js +173 -0
- package/dist/knowledge/permission-risk.d.ts +76 -0
- package/dist/knowledge/permission-risk.js +411 -0
- package/dist/knowledge/permission-templates.d.ts +38 -0
- package/dist/knowledge/permission-templates.js +234 -0
- package/dist/knowledge/permission-translation.d.ts +57 -0
- package/dist/knowledge/permission-translation.js +350 -0
- package/dist/knowledge/personal-risk.d.ts +36 -0
- package/dist/knowledge/personal-risk.js +212 -0
- package/dist/knowledge/progress-confirm.d.ts +108 -0
- package/dist/knowledge/progress-confirm.js +456 -0
- package/dist/knowledge/progress-context.d.ts +123 -0
- package/dist/knowledge/progress-context.js +452 -0
- package/dist/knowledge/progress-ledger.d.ts +63 -0
- package/dist/knowledge/progress-ledger.js +327 -0
- package/dist/knowledge/progress-puzzle.d.ts +82 -0
- package/dist/knowledge/progress-puzzle.js +219 -0
- package/dist/knowledge/progress-risk.d.ts +74 -0
- package/dist/knowledge/progress-risk.js +461 -0
- package/dist/knowledge/progress-templates.d.ts +38 -0
- package/dist/knowledge/progress-templates.js +228 -0
- package/dist/knowledge/progress-translation.d.ts +52 -0
- package/dist/knowledge/progress-translation.js +401 -0
- package/dist/knowledge/proof-confirm.d.ts +31 -0
- package/dist/knowledge/proof-confirm.js +187 -0
- package/dist/knowledge/proof-risk.d.ts +33 -0
- package/dist/knowledge/proof-risk.js +207 -0
- package/dist/knowledge/proof-translation.d.ts +52 -0
- package/dist/knowledge/proof-translation.js +283 -0
- package/dist/knowledge/registrar-risk.d.ts +34 -0
- package/dist/knowledge/registrar-risk.js +217 -0
- package/dist/knowledge/repository-confirm.d.ts +36 -0
- package/dist/knowledge/repository-confirm.js +242 -0
- package/dist/knowledge/repository-risk.d.ts +40 -0
- package/dist/knowledge/repository-risk.js +312 -0
- package/dist/knowledge/repository-translation.d.ts +58 -0
- package/dist/knowledge/repository-translation.js +422 -0
- package/dist/knowledge/resource-risk.d.ts +32 -0
- package/dist/knowledge/resource-risk.js +157 -0
- package/dist/knowledge/reward-confirm.d.ts +113 -0
- package/dist/knowledge/reward-confirm.js +496 -0
- package/dist/knowledge/reward-context.d.ts +127 -0
- package/dist/knowledge/reward-context.js +504 -0
- package/dist/knowledge/reward-ledger.d.ts +96 -0
- package/dist/knowledge/reward-ledger.js +502 -0
- package/dist/knowledge/reward-puzzle.d.ts +97 -0
- package/dist/knowledge/reward-puzzle.js +288 -0
- package/dist/knowledge/reward-risk.d.ts +84 -0
- package/dist/knowledge/reward-risk.js +545 -0
- package/dist/knowledge/reward-translation.d.ts +58 -0
- package/dist/knowledge/reward-translation.js +501 -0
- package/dist/knowledge/safety-rules.js +11 -3
- package/dist/knowledge/scenario-modes.d.ts +53 -0
- package/dist/knowledge/scenario-modes.js +302 -0
- package/dist/knowledge/service-confirm.d.ts +152 -0
- package/dist/knowledge/service-confirm.js +699 -0
- package/dist/knowledge/service-context.d.ts +66 -0
- package/dist/knowledge/service-context.js +403 -0
- package/dist/knowledge/service-ledger.d.ts +71 -0
- package/dist/knowledge/service-ledger.js +609 -0
- package/dist/knowledge/service-puzzle.d.ts +158 -0
- package/dist/knowledge/service-puzzle.js +236 -0
- package/dist/knowledge/service-risk.d.ts +108 -0
- package/dist/knowledge/service-risk.js +615 -0
- package/dist/knowledge/service-templates.d.ts +39 -0
- package/dist/knowledge/service-templates.js +418 -0
- package/dist/knowledge/service-translation.d.ts +103 -0
- package/dist/knowledge/service-translation.js +622 -0
- package/dist/knowledge/tools-reference.d.ts +17 -0
- package/dist/knowledge/tools-reference.js +151 -0
- package/dist/knowledge/treasury-confirm.d.ts +133 -0
- package/dist/knowledge/treasury-confirm.js +512 -0
- package/dist/knowledge/treasury-context.d.ts +64 -0
- package/dist/knowledge/treasury-context.js +363 -0
- package/dist/knowledge/treasury-ledger.d.ts +42 -0
- package/dist/knowledge/treasury-ledger.js +300 -0
- package/dist/knowledge/treasury-puzzle.d.ts +163 -0
- package/dist/knowledge/treasury-puzzle.js +216 -0
- package/dist/knowledge/treasury-risk.d.ts +86 -0
- package/dist/knowledge/treasury-risk.js +440 -0
- package/dist/knowledge/treasury-templates.d.ts +38 -0
- package/dist/knowledge/treasury-templates.js +316 -0
- package/dist/knowledge/treasury-translation.d.ts +78 -0
- package/dist/knowledge/treasury-translation.js +498 -0
- package/dist/knowledge/util-risk.d.ts +30 -0
- package/dist/knowledge/util-risk.js +135 -0
- package/dist/project/business-puzzle.d.ts +47 -0
- package/dist/project/business-puzzle.js +372 -0
- package/dist/project/deployment-doc.d.ts +61 -0
- package/dist/project/deployment-doc.js +432 -0
- package/dist/project/risk-aggregator.d.ts +50 -0
- package/dist/project/risk-aggregator.js +280 -0
- package/dist/project/substep-trace.d.ts +130 -0
- package/dist/project/substep-trace.js +332 -0
- package/dist/schema/call/allocation.d.ts +34 -34
- package/dist/schema/call/arbitration.d.ts +141 -141
- package/dist/schema/call/base.d.ts +386 -386
- package/dist/schema/call/base.js +3 -3
- package/dist/schema/call/bridge-handler.d.ts +5 -2
- package/dist/schema/call/bridge.d.ts +159 -159
- package/dist/schema/call/contact.d.ts +110 -110
- package/dist/schema/call/demand.d.ts +76 -76
- package/dist/schema/call/handler.d.ts +2 -3
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +58 -58
- package/dist/schema/call/order.d.ts +98 -110
- package/dist/schema/call/permission-handler.d.ts +5 -0
- package/dist/schema/call/permission-handler.js +54 -0
- package/dist/schema/call/permission.d.ts +108 -108
- package/dist/schema/call/personal.d.ts +14 -14
- package/dist/schema/call/progress.d.ts +57 -72
- package/dist/schema/call/progress.js +7 -4
- package/dist/schema/call/proof.d.ts +18 -18
- package/dist/schema/call/proof.js +12 -7
- package/dist/schema/call/repository.d.ts +154 -154
- package/dist/schema/call/reward.d.ts +55 -55
- package/dist/schema/call/service.d.ts +231 -231
- package/dist/schema/call/treasury.d.ts +93 -93
- package/dist/schema/config/index.d.ts +178 -5
- package/dist/schema/config/index.js +52 -1
- package/dist/schema/local/index.d.ts +3554 -836
- package/dist/schema/local/index.js +2 -1
- package/dist/schema/messenger/index.d.ts +162 -162
- package/dist/schema/operations.d.ts +1058 -1074
- package/dist/schema/operations.js +7 -1
- package/dist/schema/project/index.d.ts +1392 -6
- package/dist/schema/project/index.js +426 -2
- package/dist/schema/query/index.d.ts +672 -672
- package/dist/schema/schema-query/index.d.ts +23 -3
- package/dist/schema/schema-query/index.js +13 -2
- package/dist/schema/sync-layer4.d.ts +21 -0
- package/dist/schema/sync-layer4.js +261 -0
- package/dist/schema/trust/index.d.ts +26 -26
- package/dist/schemas/account_operation.output.json +718 -0
- package/dist/schemas/config_operation.output.json +173 -0
- package/dist/schemas/index.json +9 -1
- package/dist/schemas/local_info_operation.output.json +718 -0
- package/dist/schemas/local_mark_operation.output.json +718 -0
- package/dist/schemas/onchain_operations.output.json +3 -2
- package/dist/schemas/onchain_operations.schema.json +1802 -313
- package/dist/schemas/onchain_operations_allocation.schema.json +2 -1
- package/dist/schemas/onchain_operations_arbitration.schema.json +2 -1
- package/dist/schemas/onchain_operations_contact.schema.json +2 -1
- package/dist/schemas/onchain_operations_demand.schema.json +2 -1
- package/dist/schemas/onchain_operations_gen_passport.schema.json +878 -872
- package/dist/schemas/onchain_operations_gen_proof.schema.json +273 -0
- package/dist/schemas/onchain_operations_guard.schema.json +584 -70
- package/dist/schemas/onchain_operations_machine.schema.json +2 -1
- package/dist/schemas/onchain_operations_order.schema.json +13 -9
- package/dist/schemas/onchain_operations_payment.schema.json +2 -1
- package/dist/schemas/onchain_operations_permission.schema.json +2 -1
- package/dist/schemas/onchain_operations_personal.schema.json +2 -1
- package/dist/schemas/onchain_operations_progress.schema.json +14 -10
- package/dist/schemas/onchain_operations_proof.schema.json +699 -0
- package/dist/schemas/onchain_operations_repository.schema.json +2 -1
- package/dist/schemas/onchain_operations_reward.schema.json +2 -1
- package/dist/schemas/onchain_operations_service.schema.json +2 -1
- package/dist/schemas/onchain_operations_treasury.schema.json +2 -1
- package/dist/schemas/onchain_table_data.schema.json +32 -1
- package/dist/schemas/project_operation.output.json +879 -0
- package/dist/schemas/project_operation.schema.json +473 -2
- package/dist/schemas/query_toolkit.output.json +14906 -6
- package/dist/schemas/schema_query.output.json +38 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/tools/handlers/config.d.ts +1 -1
- package/dist/tools/handlers/config.js +21 -18
- package/dist/tools/handlers/file-export.d.ts +2 -2
- package/dist/tools/handlers/local.d.ts +3 -30
- package/dist/tools/handlers/local.js +14 -3
- package/dist/tools/handlers/messenger.d.ts +1 -1
- package/dist/tools/handlers/messenger.js +2 -1
- package/dist/tools/handlers/onchain.d.ts +1 -1
- package/dist/tools/handlers/onchain.js +24 -22
- package/dist/tools/handlers/project.d.ts +1 -1
- package/dist/tools/handlers/project.js +258 -18
- package/dist/tools/handlers/query.d.ts +4 -4
- package/dist/tools/handlers/schema-query.d.ts +1 -1
- package/dist/tools/handlers/schema-query.js +21 -20
- package/dist/tools/handlers/trust.d.ts +1 -1
- package/dist/tools/handlers/trust.js +2 -2
- package/dist/tools/handlers/wip.d.ts +1 -1
- package/dist/tools/handlers/wip.js +1 -1
- package/dist/tools/index.d.ts +1 -1
- package/dist/tools/index.js +55 -8
- package/dist/tools/rules-hook.d.ts +1 -1
- package/dist/tools/rules-hook.js +3 -2
- package/dist/tools/shared.d.ts +13 -22
- package/dist/tools/types.d.ts +5 -5
- package/dist/tools/wrap.d.ts +10 -2
- package/dist/tools/wrap.js +212 -0
- package/package.json +3 -3
|
@@ -0,0 +1,327 @@
|
|
|
1
|
+
import { MAX_NAMED_OPERATOR_COUNT, MAX_NAMED_OPERATOR_ADDRESS_COUNT, MAX_CONTEXT_REPOSITORY_COUNT, } from "@wowok/wowok";
|
|
2
|
+
export { MAX_NAMED_OPERATOR_COUNT, MAX_NAMED_OPERATOR_ADDRESS_COUNT, MAX_CONTEXT_REPOSITORY_COUNT, };
|
|
3
|
+
export const PROGRESS_NEW = {
|
|
4
|
+
index: 220,
|
|
5
|
+
name: "PROGRESS_NEW",
|
|
6
|
+
description: "Create new Progress (asserted by progress::new / new_with_passport)",
|
|
7
|
+
governed_operations: ["progress::new", "progress::new_with_passport"],
|
|
8
|
+
sdk_exposed: false,
|
|
9
|
+
};
|
|
10
|
+
export const PROGRESS_NAMED_OPERATOR = {
|
|
11
|
+
index: 221,
|
|
12
|
+
name: "PROGRESS_NAMED_OPERATOR",
|
|
13
|
+
description: "Manage named operators (add/set/remove) for the namedOperator namespace",
|
|
14
|
+
governed_operations: [
|
|
15
|
+
"progress::namedOperator_add",
|
|
16
|
+
"progress::namedOperator_set",
|
|
17
|
+
"progress::namedOperator_remove",
|
|
18
|
+
"progress::namedOperator_add_with_passport",
|
|
19
|
+
"progress::namedOperator_set_with_passport",
|
|
20
|
+
"progress::namedOperator_remove_with_passport",
|
|
21
|
+
],
|
|
22
|
+
sdk_exposed: true,
|
|
23
|
+
};
|
|
24
|
+
export const PROGRESS_TASK = {
|
|
25
|
+
index: 222,
|
|
26
|
+
name: "PROGRESS_TASK",
|
|
27
|
+
description: "Submit task (one-time, immutable once set — E_TASK_ALREADY_SET)",
|
|
28
|
+
governed_operations: ["progress::task_set", "progress::task_set_with_passport"],
|
|
29
|
+
sdk_exposed: true,
|
|
30
|
+
};
|
|
31
|
+
export const PROGRESS_CONTEXT_REPOSITORY = {
|
|
32
|
+
index: 223,
|
|
33
|
+
name: "PROGRESS_CONTEXT_REPOSITORY",
|
|
34
|
+
description: "Bind/unbind context Repository (≤ MAX_CONTEXT_REPOSITORY_COUNT=30)",
|
|
35
|
+
governed_operations: [
|
|
36
|
+
"progress::context_repository_add",
|
|
37
|
+
"progress::context_repository_remove",
|
|
38
|
+
"progress::context_repository_clear",
|
|
39
|
+
"progress::context_repository_add_with_passport",
|
|
40
|
+
"progress::context_repository_remove_with_passport",
|
|
41
|
+
"progress::context_repository_clear_with_passport",
|
|
42
|
+
],
|
|
43
|
+
sdk_exposed: true,
|
|
44
|
+
};
|
|
45
|
+
export const PROGRESS_UNHOLD = {
|
|
46
|
+
index: 224,
|
|
47
|
+
name: "PROGRESS_UNHOLD",
|
|
48
|
+
description: "Force unhold (adminUnhold) — bypasses holder check, releases blocked forward",
|
|
49
|
+
governed_operations: ["progress::unhold", "progress::unhold_with_passport"],
|
|
50
|
+
sdk_exposed: true,
|
|
51
|
+
};
|
|
52
|
+
export const PROGRESS_OWNER_RECEIVE = {
|
|
53
|
+
index: 225,
|
|
54
|
+
name: "PROGRESS_OWNER_RECEIVE",
|
|
55
|
+
description: "Owner receives objects/coins (unwrap Receiving<K> → owner)",
|
|
56
|
+
governed_operations: [
|
|
57
|
+
"progress::owner_receive",
|
|
58
|
+
"progress::owner_receive_object",
|
|
59
|
+
"progress::owner_receive_with_passport",
|
|
60
|
+
"progress::owner_receive_object_with_passport",
|
|
61
|
+
],
|
|
62
|
+
sdk_exposed: false,
|
|
63
|
+
};
|
|
64
|
+
export const PROGRESS_PERMISSIONS = [
|
|
65
|
+
PROGRESS_NEW,
|
|
66
|
+
PROGRESS_NAMED_OPERATOR,
|
|
67
|
+
PROGRESS_TASK,
|
|
68
|
+
PROGRESS_CONTEXT_REPOSITORY,
|
|
69
|
+
PROGRESS_UNHOLD,
|
|
70
|
+
PROGRESS_OWNER_RECEIVE,
|
|
71
|
+
];
|
|
72
|
+
export const PROGRESS_SCENES = [
|
|
73
|
+
{
|
|
74
|
+
id: "progress_task_submit",
|
|
75
|
+
name: "Task submission & binding workflow",
|
|
76
|
+
industry: ["universal", "ecommerce", "logistics", "education"],
|
|
77
|
+
scenario: "Submit a task (Order/Reward/etc.) to Progress via task_set. " +
|
|
78
|
+
"Task is one-time, immutable — once set, E_TASK_ALREADY_SET blocks any re-assignment. " +
|
|
79
|
+
"Binds Progress 1:1 to the task object for the rest of its lifecycle.",
|
|
80
|
+
phases: ["task_binding", "forward_advance"],
|
|
81
|
+
requires_published_machine: true,
|
|
82
|
+
requires_order_bound: true,
|
|
83
|
+
named_operator_roles: [],
|
|
84
|
+
builtin_indexes_consumed: [PROGRESS_TASK],
|
|
85
|
+
typical_context_repository_count: 0,
|
|
86
|
+
uses_hold_mechanism: false,
|
|
87
|
+
uses_admin_unhold: false,
|
|
88
|
+
common_patterns: [
|
|
89
|
+
"task_set is one-time: verify task address before submission (E_TASK_ALREADY_SET blocks reset)",
|
|
90
|
+
"task is usually an Order created by service::buy → Progress.task = Order address",
|
|
91
|
+
"Without task, Forward advancement falls back to non-order next()/hold() paths",
|
|
92
|
+
],
|
|
93
|
+
recommended_templates: ["T-PR-01"],
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "progress_named_operator",
|
|
97
|
+
name: "Named operator namespace management",
|
|
98
|
+
industry: ["universal", "logistics", "arbitration", "freelance"],
|
|
99
|
+
scenario: "Manage named_operator namespace for a Progress. Each named operator is a (name → address list) " +
|
|
100
|
+
"binding used by Machine.forward.namedOperator to gate next()/hold() advancement. " +
|
|
101
|
+
"Up to 60 named operators per Progress, up to 80 addresses per operator.",
|
|
102
|
+
phases: ["named_operator_mgmt"],
|
|
103
|
+
requires_published_machine: true,
|
|
104
|
+
requires_order_bound: false,
|
|
105
|
+
named_operator_roles: [
|
|
106
|
+
{ role: "seller", typical_count: 1 },
|
|
107
|
+
{ role: "logistics", typical_count: 1 },
|
|
108
|
+
{ role: "reviewer", typical_count: 3 },
|
|
109
|
+
{ role: "arbitrator", typical_count: 5 },
|
|
110
|
+
],
|
|
111
|
+
builtin_indexes_consumed: [PROGRESS_NAMED_OPERATOR],
|
|
112
|
+
typical_context_repository_count: 0,
|
|
113
|
+
uses_hold_mechanism: false,
|
|
114
|
+
uses_admin_unhold: false,
|
|
115
|
+
common_patterns: [
|
|
116
|
+
"namedOperator name='': special case — means OrderHolder (order.owner/agent), NOT a real named operator",
|
|
117
|
+
"add/set/remove are idempotent on duplicate addresses (vector::contains check before push)",
|
|
118
|
+
"Use 'set' to REPLACE an operator's address list; use 'add' to extend; 'remove' to subtract",
|
|
119
|
+
"Names must satisfy common::NAME (isValidName) — non-empty, length-bounded",
|
|
120
|
+
],
|
|
121
|
+
recommended_templates: ["T-PR-01", "T-PR-02"],
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
id: "progress_unhold",
|
|
125
|
+
name: "Hold release (unhold / adminUnhold) workflow",
|
|
126
|
+
industry: ["content", "rental", "arbitration", "subscription"],
|
|
127
|
+
scenario: "Release a forward that was previously held. Two paths: " +
|
|
128
|
+
"(a) unhold by original holder (named_operator match); " +
|
|
129
|
+
"(b) adminUnhold (224) by permission-table holder — bypasses holder check. " +
|
|
130
|
+
"adminUnhold is the deadlock-resolution escape hatch when a holder is unresponsive.",
|
|
131
|
+
phases: ["hold_state", "unhold_state"],
|
|
132
|
+
requires_published_machine: true,
|
|
133
|
+
requires_order_bound: true,
|
|
134
|
+
named_operator_roles: [
|
|
135
|
+
{ role: "holder", typical_count: 1 },
|
|
136
|
+
{ role: "admin", typical_count: 1 },
|
|
137
|
+
],
|
|
138
|
+
builtin_indexes_consumed: [PROGRESS_UNHOLD],
|
|
139
|
+
typical_context_repository_count: 0,
|
|
140
|
+
uses_hold_mechanism: true,
|
|
141
|
+
uses_admin_unhold: true,
|
|
142
|
+
common_patterns: [
|
|
143
|
+
"unhold checks sender_has_permission_idcheck(224): if yes, force release; if no, require holder match",
|
|
144
|
+
"adminUnhold has wider blast radius — only grant 224 to trusted recovery operators",
|
|
145
|
+
"If forward already accomplished, E_FORWARD_ALREADY_ACCOMPLISHED blocks re-hold",
|
|
146
|
+
"Repeated hold/unhold cycles indicate a stuck workflow — surface to order-monitor",
|
|
147
|
+
],
|
|
148
|
+
recommended_templates: ["T-PR-05"],
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "progress_context_repository",
|
|
152
|
+
name: "Context Repository binding workflow",
|
|
153
|
+
industry: ["education", "content", "rental", "cross_chain"],
|
|
154
|
+
scenario: "Bind/unbind Repository objects as Progress context_repositories. " +
|
|
155
|
+
"Used to provide query-time context (learning progress, inspection records, bridge state). " +
|
|
156
|
+
"Up to MAX_CONTEXT_REPOSITORY_COUNT=30 repositories per Progress.",
|
|
157
|
+
phases: ["context_binding"],
|
|
158
|
+
requires_published_machine: true,
|
|
159
|
+
requires_order_bound: false,
|
|
160
|
+
named_operator_roles: [],
|
|
161
|
+
builtin_indexes_consumed: [PROGRESS_CONTEXT_REPOSITORY],
|
|
162
|
+
typical_context_repository_count: 3,
|
|
163
|
+
uses_hold_mechanism: false,
|
|
164
|
+
uses_admin_unhold: false,
|
|
165
|
+
common_patterns: [
|
|
166
|
+
"context_repository_add registers affiliation via Registrar (enables cross-object queries)",
|
|
167
|
+
"context_repository_remove disaffiliates — Repository may be garbage-collected if no other refs",
|
|
168
|
+
"context_repository_clear empties the entire list in one transaction",
|
|
169
|
+
"add is idempotent: if Repository already in list, no-op (vector::contains check)",
|
|
170
|
+
"Bind before forward advance so on-chain guards can read context data",
|
|
171
|
+
],
|
|
172
|
+
recommended_templates: ["T-PR-03"],
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
id: "progress_owner_receive",
|
|
176
|
+
name: "Owner receive (unwrap) workflow",
|
|
177
|
+
industry: ["finance", "treasury", "rental", "freelance"],
|
|
178
|
+
scenario: "Owner receives Receiving<K> objects or CoinWrapper<T> coins sent to the Progress object. " +
|
|
179
|
+
"unwrap → permission::owner_receive_inner forwards to Permission owner. " +
|
|
180
|
+
"Used at terminal nodes (deposit_refunded, completed, enforced) to disburse funds.",
|
|
181
|
+
phases: ["owner_receive"],
|
|
182
|
+
requires_published_machine: true,
|
|
183
|
+
requires_order_bound: true,
|
|
184
|
+
named_operator_roles: [],
|
|
185
|
+
builtin_indexes_consumed: [PROGRESS_OWNER_RECEIVE],
|
|
186
|
+
typical_context_repository_count: 0,
|
|
187
|
+
uses_hold_mechanism: false,
|
|
188
|
+
uses_admin_unhold: false,
|
|
189
|
+
common_patterns: [
|
|
190
|
+
"owner_receive unwraps CoinWrapper<T> via Payment.unwrap_with_check (amount validation)",
|
|
191
|
+
"owner_receive_object receives a generic K:key+store object and forwards to Permission owner",
|
|
192
|
+
"Triggered at terminal nodes (e.g. 'deposit_refunded' in rental, 'enforced' in arbitration)",
|
|
193
|
+
"Permission owner ≠ Progress creator: receives flow to whoever owns the bound Machine's Permission",
|
|
194
|
+
],
|
|
195
|
+
recommended_templates: ["T-PR-06"],
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
id: "progress_completed",
|
|
199
|
+
name: "Forward advancement & session completion",
|
|
200
|
+
industry: ["universal"],
|
|
201
|
+
scenario: "Advance Progress via next()/order_next() — accumulates weights in session.forwards, " +
|
|
202
|
+
"and when weights ≥ threshold, moves session into history and updates Progress.current. " +
|
|
203
|
+
"This is the canonical Forward advancement path for ALL non-hold operations.",
|
|
204
|
+
phases: ["forward_advance", "completed"],
|
|
205
|
+
requires_published_machine: true,
|
|
206
|
+
requires_order_bound: true,
|
|
207
|
+
named_operator_roles: [
|
|
208
|
+
{ role: "OrderHolder", typical_count: 1 },
|
|
209
|
+
{ role: "next_node_operator", typical_count: 1 },
|
|
210
|
+
],
|
|
211
|
+
builtin_indexes_consumed: [],
|
|
212
|
+
typical_context_repository_count: 0,
|
|
213
|
+
uses_hold_mechanism: false,
|
|
214
|
+
uses_admin_unhold: false,
|
|
215
|
+
common_patterns: [
|
|
216
|
+
"Forward guard (Some): requires Passport; uses passport::result_for_guard for verification",
|
|
217
|
+
"Forward guard (None): requires permissionIndex (Some) or namedOperator match (ASSERT_PERMISSION)",
|
|
218
|
+
"session.weights += forward.weight; when ≥ threshold, push session into ParentTableVec<History>",
|
|
219
|
+
"Progress.current = next_node only after session completes (atomic update)",
|
|
220
|
+
"E_NOT_THE_HOLDER: if forward was held by another address, next() aborts",
|
|
221
|
+
"E_FORWARD_ALREADY_ACCOMPLISHED: re-hold on completed forward is blocked",
|
|
222
|
+
],
|
|
223
|
+
recommended_templates: ["T-PR-04"],
|
|
224
|
+
},
|
|
225
|
+
];
|
|
226
|
+
export const PROGRESS_LEDGER_VERSION = "1.0.0";
|
|
227
|
+
export function getScenesByPhase(phase) {
|
|
228
|
+
return PROGRESS_SCENES.filter(s => s.phases.includes(phase));
|
|
229
|
+
}
|
|
230
|
+
export function findSceneById(id) {
|
|
231
|
+
return PROGRESS_SCENES.find(s => s.id === id);
|
|
232
|
+
}
|
|
233
|
+
export function getScenesByIndustry(industry) {
|
|
234
|
+
return PROGRESS_SCENES.filter(s => s.industry.includes(industry) || s.industry.includes("universal"));
|
|
235
|
+
}
|
|
236
|
+
export function getBuiltinPermissionByIndex(index) {
|
|
237
|
+
return PROGRESS_PERMISSIONS.find(p => p.index === index);
|
|
238
|
+
}
|
|
239
|
+
export function isProgressBuiltinPermission(index) {
|
|
240
|
+
return getBuiltinPermissionByIndex(index) !== undefined;
|
|
241
|
+
}
|
|
242
|
+
export function inferSceneFromIntent(intent) {
|
|
243
|
+
const lower = intent.toLowerCase();
|
|
244
|
+
const keywordMap = [
|
|
245
|
+
["adminunhold", "progress_unhold"],
|
|
246
|
+
["admin unhold", "progress_unhold"],
|
|
247
|
+
["force unhold", "progress_unhold"],
|
|
248
|
+
["unhold", "progress_unhold"],
|
|
249
|
+
["release hold", "progress_unhold"],
|
|
250
|
+
["owner_receive", "progress_owner_receive"],
|
|
251
|
+
["owner receive", "progress_owner_receive"],
|
|
252
|
+
["unwrap", "progress_owner_receive"],
|
|
253
|
+
["context_repository", "progress_context_repository"],
|
|
254
|
+
["context repository", "progress_context_repository"],
|
|
255
|
+
["repository binding", "progress_context_repository"],
|
|
256
|
+
["named_operator", "progress_named_operator"],
|
|
257
|
+
["named operator", "progress_named_operator"],
|
|
258
|
+
["namedoperator", "progress_named_operator"],
|
|
259
|
+
["task_set", "progress_task_submit"],
|
|
260
|
+
["task set", "progress_task_submit"],
|
|
261
|
+
["submit task", "progress_task_submit"],
|
|
262
|
+
["next", "progress_completed"],
|
|
263
|
+
["order_next", "progress_completed"],
|
|
264
|
+
["advance", "progress_completed"],
|
|
265
|
+
["complete", "progress_completed"],
|
|
266
|
+
];
|
|
267
|
+
for (const [kw, sceneId] of keywordMap) {
|
|
268
|
+
if (lower.includes(kw)) {
|
|
269
|
+
const scene = findSceneById(sceneId);
|
|
270
|
+
if (scene)
|
|
271
|
+
return scene;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return undefined;
|
|
275
|
+
}
|
|
276
|
+
export function getAllBuiltinPermissions() {
|
|
277
|
+
return [...PROGRESS_PERMISSIONS];
|
|
278
|
+
}
|
|
279
|
+
export function getProgressScenesCount() {
|
|
280
|
+
return PROGRESS_SCENES.length;
|
|
281
|
+
}
|
|
282
|
+
export function validateNamedOperatorAddressList(addresses) {
|
|
283
|
+
const violations = [];
|
|
284
|
+
if (addresses.length > MAX_NAMED_OPERATOR_ADDRESS_COUNT) {
|
|
285
|
+
violations.push(`Named operator address count ${addresses.length} exceeds MAX_NAMED_OPERATOR_ADDRESS_COUNT ${MAX_NAMED_OPERATOR_ADDRESS_COUNT}`);
|
|
286
|
+
}
|
|
287
|
+
const seen = new Set();
|
|
288
|
+
for (const a of addresses) {
|
|
289
|
+
if (seen.has(a)) {
|
|
290
|
+
violations.push(`Duplicate address in list: ${a} (Move will dedupe silently)`);
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
seen.add(a);
|
|
294
|
+
}
|
|
295
|
+
return { ok: violations.length === 0, violations };
|
|
296
|
+
}
|
|
297
|
+
export function validateNamedOperatorCount(currentNamedOperatorCount) {
|
|
298
|
+
if (currentNamedOperatorCount >= MAX_NAMED_OPERATOR_COUNT) {
|
|
299
|
+
return {
|
|
300
|
+
ok: false,
|
|
301
|
+
violation: `Named operator count ${currentNamedOperatorCount} would exceed MAX_NAMED_OPERATOR_COUNT ${MAX_NAMED_OPERATOR_COUNT}`,
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
return { ok: true };
|
|
305
|
+
}
|
|
306
|
+
export function validateContextRepositoryCount(currentRepositoryCount, addCount) {
|
|
307
|
+
const newCount = currentRepositoryCount + addCount;
|
|
308
|
+
if (newCount > MAX_CONTEXT_REPOSITORY_COUNT) {
|
|
309
|
+
return {
|
|
310
|
+
ok: false,
|
|
311
|
+
violation: `Context repository count ${newCount} would exceed MAX_CONTEXT_REPOSITORY_COUNT ${MAX_CONTEXT_REPOSITORY_COUNT}`,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
return { ok: true };
|
|
315
|
+
}
|
|
316
|
+
export const PROGRESS_CROSS_OBJECT_REFS = [
|
|
317
|
+
{ object: "Machine", phase: "universal", relationship: "Progress.machine (immutable bind, E_MACHINE_NOT_MATCH on every op)" },
|
|
318
|
+
{ object: "Order", phase: "forward_advance", relationship: "Progress.task = Order.address (1:1, set via task_set or service::buy)" },
|
|
319
|
+
{ object: "Order", phase: "forward_advance", relationship: "order_next / order_hold: order.has_op_permission(order, ctx) gates Forward advance" },
|
|
320
|
+
{ object: "Permission", phase: "universal", relationship: "Machine.permission is borrowed for ALL 220-225 assertions" },
|
|
321
|
+
{ object: "Repository", phase: "context_binding", relationship: "context_repositories: vector<address> (≤ 30), affiliated via Registrar" },
|
|
322
|
+
{ object: "Service", phase: "creation", relationship: "service::buy → new_imp (bypasses 220 assertion — package-internal entry)" },
|
|
323
|
+
{ object: "Passport", phase: "forward_advance", relationship: "Forward.guard (Some) requires Passport + passport::result_for_guard" },
|
|
324
|
+
{ object: "Passport", phase: "unhold_state", relationship: "unhold_with_passport: 224 check via passport (fallback when sender_has_permission_idcheck fails)" },
|
|
325
|
+
{ object: "Payment", phase: "owner_receive", relationship: "owner_receive unwraps CoinWrapper<T> via Payment.unwrap_with_check" },
|
|
326
|
+
{ object: "Allocation", phase: "completed", relationship: "Terminal node triggers Allocation alloc (e.g. 'completed', 'enforced', 'deposit_refunded')" },
|
|
327
|
+
];
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type ProgressBuiltinPermissionEntry } from "./progress-ledger.js";
|
|
2
|
+
export interface ProgressIntentPuzzle {
|
|
3
|
+
action: "create" | "operate" | "task_set" | "named_operator" | "repository" | "owner_receive" | "query";
|
|
4
|
+
target_progress?: string;
|
|
5
|
+
rule_sentence: string;
|
|
6
|
+
failure_conditions: string[];
|
|
7
|
+
}
|
|
8
|
+
export interface ProgressWorkflowPuzzle {
|
|
9
|
+
machine: string;
|
|
10
|
+
machine_published: boolean;
|
|
11
|
+
order: string | null;
|
|
12
|
+
current_node: string;
|
|
13
|
+
forward_target?: {
|
|
14
|
+
next_node_name: string;
|
|
15
|
+
forward: string;
|
|
16
|
+
};
|
|
17
|
+
use_order_variant: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface ProgressNamedOperatorPuzzle {
|
|
20
|
+
name: string;
|
|
21
|
+
op: "add" | "set" | "remove";
|
|
22
|
+
addresses: string[];
|
|
23
|
+
is_order_holder_namespace: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ProgressTaskPuzzle {
|
|
26
|
+
task_address: string;
|
|
27
|
+
submitted_data?: {
|
|
28
|
+
type: "json" | "bcs" | "text";
|
|
29
|
+
payload: string;
|
|
30
|
+
};
|
|
31
|
+
immutability_acknowledged: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface ProgressPermissionPuzzle {
|
|
34
|
+
builtin_indexes_used: ProgressBuiltinPermissionEntry[];
|
|
35
|
+
forward_permission_index: number | null;
|
|
36
|
+
uses_named_operator_short_circuit: boolean;
|
|
37
|
+
requires_passport: boolean;
|
|
38
|
+
uses_order_permission: boolean;
|
|
39
|
+
}
|
|
40
|
+
export interface ProgressConstraintChecklist {
|
|
41
|
+
F_PR_01_machine_published: boolean;
|
|
42
|
+
F_PR_02_machine_bound: boolean;
|
|
43
|
+
F_PR_03_named_operator_count_le_60: boolean;
|
|
44
|
+
F_PR_04_named_operator_addr_le_80: boolean;
|
|
45
|
+
F_PR_05_context_repository_le_30: boolean;
|
|
46
|
+
F_PR_06_task_one_time: boolean;
|
|
47
|
+
F_PR_07_forward_exists_in_machine: boolean;
|
|
48
|
+
F_PR_08_holder_match_for_unhold: boolean;
|
|
49
|
+
}
|
|
50
|
+
export type ProgressPuzzleDimension = "A" | "B" | "C" | "D" | "E" | "F";
|
|
51
|
+
export interface ProgressPuzzle {
|
|
52
|
+
intent?: ProgressIntentPuzzle;
|
|
53
|
+
workflow?: ProgressWorkflowPuzzle;
|
|
54
|
+
named_operator?: ProgressNamedOperatorPuzzle;
|
|
55
|
+
task?: ProgressTaskPuzzle;
|
|
56
|
+
permission?: ProgressPermissionPuzzle;
|
|
57
|
+
constraints?: ProgressConstraintChecklist;
|
|
58
|
+
}
|
|
59
|
+
export interface ProgressPuzzleCompleteness {
|
|
60
|
+
dimensions: ProgressPuzzleDimension[];
|
|
61
|
+
missing: ProgressPuzzleDimension[];
|
|
62
|
+
missing_details: {
|
|
63
|
+
dimension: ProgressPuzzleDimension;
|
|
64
|
+
reason: string;
|
|
65
|
+
}[];
|
|
66
|
+
complete: boolean;
|
|
67
|
+
next_step: string;
|
|
68
|
+
}
|
|
69
|
+
export declare function initPuzzleFromIntent(intent: Partial<ProgressIntentPuzzle>): ProgressPuzzle;
|
|
70
|
+
export declare function checkPuzzleCompleteness(puzzle: ProgressPuzzle): ProgressPuzzleCompleteness;
|
|
71
|
+
export interface ProgressConstraintViolation {
|
|
72
|
+
constraint_id: string;
|
|
73
|
+
severity: "CRITICAL" | "HIGH" | "MEDIUM" | "LOW";
|
|
74
|
+
message: string;
|
|
75
|
+
current_value?: string | number;
|
|
76
|
+
limit?: string | number;
|
|
77
|
+
}
|
|
78
|
+
export declare function validateConstraints(puzzle: ProgressPuzzle): ProgressConstraintViolation[];
|
|
79
|
+
export declare function generateConfirmationText(puzzle: ProgressPuzzle): string;
|
|
80
|
+
export declare function resolveBuiltinPermission(index: number): ProgressBuiltinPermissionEntry | undefined;
|
|
81
|
+
export declare function isOrderHolderForward(puzzle: ProgressPuzzle): boolean;
|
|
82
|
+
export declare function getRelevantDimensions(action: ProgressIntentPuzzle["action"]): ProgressPuzzleDimension[];
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { MAX_NAMED_OPERATOR_ADDRESS_COUNT, } from "@wowok/wowok";
|
|
2
|
+
import { getBuiltinPermissionByIndex, } from "./progress-ledger.js";
|
|
3
|
+
export function initPuzzleFromIntent(intent) {
|
|
4
|
+
const puzzle = {};
|
|
5
|
+
if (intent.action || intent.rule_sentence) {
|
|
6
|
+
puzzle.intent = {
|
|
7
|
+
action: intent.action ?? "operate",
|
|
8
|
+
target_progress: intent.target_progress,
|
|
9
|
+
rule_sentence: intent.rule_sentence ?? "",
|
|
10
|
+
failure_conditions: intent.failure_conditions ?? [],
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
puzzle.constraints = {
|
|
14
|
+
F_PR_01_machine_published: false,
|
|
15
|
+
F_PR_02_machine_bound: false,
|
|
16
|
+
F_PR_03_named_operator_count_le_60: true,
|
|
17
|
+
F_PR_04_named_operator_addr_le_80: true,
|
|
18
|
+
F_PR_05_context_repository_le_30: true,
|
|
19
|
+
F_PR_06_task_one_time: true,
|
|
20
|
+
F_PR_07_forward_exists_in_machine: false,
|
|
21
|
+
F_PR_08_holder_match_for_unhold: true,
|
|
22
|
+
};
|
|
23
|
+
return puzzle;
|
|
24
|
+
}
|
|
25
|
+
export function checkPuzzleCompleteness(puzzle) {
|
|
26
|
+
const missing = [];
|
|
27
|
+
const missing_details = [];
|
|
28
|
+
if (!puzzle.intent) {
|
|
29
|
+
missing.push("A");
|
|
30
|
+
missing_details.push({ dimension: "A", reason: "Intent not specified (action + rule_sentence)" });
|
|
31
|
+
}
|
|
32
|
+
else if (!puzzle.intent.rule_sentence) {
|
|
33
|
+
missing.push("A");
|
|
34
|
+
missing_details.push({ dimension: "A", reason: "rule_sentence is empty" });
|
|
35
|
+
}
|
|
36
|
+
const isQueryOnly = puzzle.intent?.action === "query";
|
|
37
|
+
if (!isQueryOnly) {
|
|
38
|
+
if (!puzzle.workflow) {
|
|
39
|
+
missing.push("B");
|
|
40
|
+
missing_details.push({ dimension: "B", reason: "Workflow not specified (machine + current_node)" });
|
|
41
|
+
}
|
|
42
|
+
else if (!puzzle.workflow.machine) {
|
|
43
|
+
missing.push("B");
|
|
44
|
+
missing_details.push({ dimension: "B", reason: "machine address missing" });
|
|
45
|
+
}
|
|
46
|
+
else if (!puzzle.workflow.machine_published) {
|
|
47
|
+
missing.push("B");
|
|
48
|
+
missing_details.push({ dimension: "B", reason: "Machine not published — Progress requires published Machine" });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
if (puzzle.intent?.action === "named_operator") {
|
|
52
|
+
if (!puzzle.named_operator) {
|
|
53
|
+
missing.push("C");
|
|
54
|
+
missing_details.push({ dimension: "C", reason: "named_operator config not specified (name + op + addresses)" });
|
|
55
|
+
}
|
|
56
|
+
else if (!puzzle.named_operator.name && !puzzle.named_operator.is_order_holder_namespace) {
|
|
57
|
+
missing.push("C");
|
|
58
|
+
missing_details.push({ dimension: "C", reason: "named_operator.name is empty (use is_order_holder_namespace=true for OrderHolder)" });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (puzzle.intent?.action === "task_set") {
|
|
62
|
+
if (!puzzle.task) {
|
|
63
|
+
missing.push("D");
|
|
64
|
+
missing_details.push({ dimension: "D", reason: "Task data not specified (task_address + immutability_acknowledged)" });
|
|
65
|
+
}
|
|
66
|
+
else if (!puzzle.task.task_address) {
|
|
67
|
+
missing.push("D");
|
|
68
|
+
missing_details.push({ dimension: "D", reason: "task_address missing" });
|
|
69
|
+
}
|
|
70
|
+
else if (!puzzle.task.immutability_acknowledged) {
|
|
71
|
+
missing.push("D");
|
|
72
|
+
missing_details.push({ dimension: "D", reason: "immutability_acknowledged=false — user must acknowledge task is one-time" });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (!puzzle.permission) {
|
|
76
|
+
missing.push("E");
|
|
77
|
+
missing_details.push({ dimension: "E", reason: "Permission config not specified (builtin_indexes / forward_permission_index / passport)" });
|
|
78
|
+
}
|
|
79
|
+
if (!puzzle.constraints) {
|
|
80
|
+
missing.push("F");
|
|
81
|
+
missing_details.push({ dimension: "F", reason: "Constraints not checked" });
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
dimensions: ["A", "B", "C", "D", "E", "F"],
|
|
85
|
+
missing,
|
|
86
|
+
missing_details,
|
|
87
|
+
complete: missing.length === 0,
|
|
88
|
+
next_step: missing.length === 0
|
|
89
|
+
? "Puzzle complete — ready for confirmation text generation"
|
|
90
|
+
: `Next: complete dimension ${missing[0]} — ${missing_details[0].reason}`,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
export function validateConstraints(puzzle) {
|
|
94
|
+
const violations = [];
|
|
95
|
+
if (puzzle.workflow && !puzzle.workflow.machine_published) {
|
|
96
|
+
violations.push({
|
|
97
|
+
constraint_id: "F-PR-01",
|
|
98
|
+
severity: "CRITICAL",
|
|
99
|
+
message: `Machine ${puzzle.workflow.machine} is not published — Progress requires a published Machine`,
|
|
100
|
+
current_value: "unpublished",
|
|
101
|
+
limit: "published",
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
if (puzzle.named_operator) {
|
|
105
|
+
if (puzzle.named_operator.addresses.length > MAX_NAMED_OPERATOR_ADDRESS_COUNT) {
|
|
106
|
+
violations.push({
|
|
107
|
+
constraint_id: "F-PR-04",
|
|
108
|
+
severity: "HIGH",
|
|
109
|
+
message: `named_operator "${puzzle.named_operator.name}" has ${puzzle.named_operator.addresses.length} addresses, exceeds MAX_NAMED_OPERATOR_ADDRESS_COUNT ${MAX_NAMED_OPERATOR_ADDRESS_COUNT}`,
|
|
110
|
+
current_value: puzzle.named_operator.addresses.length,
|
|
111
|
+
limit: MAX_NAMED_OPERATOR_ADDRESS_COUNT,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (puzzle.task && !puzzle.task.immutability_acknowledged) {
|
|
116
|
+
violations.push({
|
|
117
|
+
constraint_id: "F-PR-06",
|
|
118
|
+
severity: "HIGH",
|
|
119
|
+
message: "Task immutability not acknowledged — task is one-time, E_TASK_ALREADY_SET blocks reset",
|
|
120
|
+
current_value: "not_acknowledged",
|
|
121
|
+
limit: "acknowledged",
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (puzzle.intent?.action === "operate" &&
|
|
125
|
+
puzzle.intent.rule_sentence.toLowerCase().includes("unhold") &&
|
|
126
|
+
puzzle.constraints &&
|
|
127
|
+
!puzzle.constraints.F_PR_08_holder_match_for_unhold) {
|
|
128
|
+
violations.push({
|
|
129
|
+
constraint_id: "F-PR-08",
|
|
130
|
+
severity: "HIGH",
|
|
131
|
+
message: "unhold requires sender == holder OR sender has 224 permission (adminUnhold)",
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
return violations;
|
|
135
|
+
}
|
|
136
|
+
export function generateConfirmationText(puzzle) {
|
|
137
|
+
const lines = [];
|
|
138
|
+
lines.push("═══ Progress Confirmation ═══");
|
|
139
|
+
lines.push("");
|
|
140
|
+
if (puzzle.intent) {
|
|
141
|
+
lines.push(`Action: ${puzzle.intent.action}`);
|
|
142
|
+
if (puzzle.intent.target_progress)
|
|
143
|
+
lines.push(`Target Progress: ${puzzle.intent.target_progress}`);
|
|
144
|
+
lines.push(`Rule: ${puzzle.intent.rule_sentence}`);
|
|
145
|
+
if (puzzle.intent.failure_conditions.length > 0) {
|
|
146
|
+
lines.push("Failure conditions:");
|
|
147
|
+
for (const fc of puzzle.intent.failure_conditions)
|
|
148
|
+
lines.push(` - ${fc}`);
|
|
149
|
+
}
|
|
150
|
+
lines.push("");
|
|
151
|
+
}
|
|
152
|
+
if (puzzle.workflow) {
|
|
153
|
+
lines.push("─ Workflow ──────────────");
|
|
154
|
+
lines.push(`Machine: ${puzzle.workflow.machine} (published: ${puzzle.workflow.machine_published ? "YES" : "NO"})`);
|
|
155
|
+
lines.push(`Order/Task: ${puzzle.workflow.order ?? "(not bound)"}`);
|
|
156
|
+
lines.push(`Current node: ${puzzle.workflow.current_node}`);
|
|
157
|
+
if (puzzle.workflow.forward_target) {
|
|
158
|
+
lines.push(`Forward target: ${puzzle.workflow.current_node} --(${puzzle.workflow.forward_target.forward})--> ${puzzle.workflow.forward_target.next_node_name}`);
|
|
159
|
+
}
|
|
160
|
+
lines.push(`Use order variant: ${puzzle.workflow.use_order_variant ? "YES (order_next / order_hold)" : "NO (next / hold)"}`);
|
|
161
|
+
lines.push("");
|
|
162
|
+
}
|
|
163
|
+
if (puzzle.named_operator) {
|
|
164
|
+
lines.push("─ Named Operator ──────────────");
|
|
165
|
+
lines.push(`Name: "${puzzle.named_operator.name}"${puzzle.named_operator.is_order_holder_namespace ? " (OrderHolder namespace)" : ""}`);
|
|
166
|
+
lines.push(`Op: ${puzzle.named_operator.op}`);
|
|
167
|
+
lines.push(`Addresses (${puzzle.named_operator.addresses.length}/${MAX_NAMED_OPERATOR_ADDRESS_COUNT}): ${puzzle.named_operator.addresses.join(", ")}`);
|
|
168
|
+
lines.push("");
|
|
169
|
+
}
|
|
170
|
+
if (puzzle.task) {
|
|
171
|
+
lines.push("─ Task ──────────────");
|
|
172
|
+
lines.push(`Task address: ${puzzle.task.task_address}`);
|
|
173
|
+
if (puzzle.task.submitted_data) {
|
|
174
|
+
lines.push(`Submitted data (${puzzle.task.submitted_data.type}): ${puzzle.task.submitted_data.payload.slice(0, 80)}${puzzle.task.submitted_data.payload.length > 80 ? "…" : ""}`);
|
|
175
|
+
}
|
|
176
|
+
lines.push(`Immutability acknowledged: ${puzzle.task.immutability_acknowledged ? "YES" : "NO"}`);
|
|
177
|
+
lines.push("");
|
|
178
|
+
}
|
|
179
|
+
if (puzzle.permission) {
|
|
180
|
+
lines.push("─ Permission ──────────────");
|
|
181
|
+
if (puzzle.permission.builtin_indexes_used.length > 0) {
|
|
182
|
+
lines.push("Builtin indexes used (management):");
|
|
183
|
+
for (const p of puzzle.permission.builtin_indexes_used) {
|
|
184
|
+
lines.push(` [${p.index}] ${p.name}: ${p.description}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (puzzle.permission.forward_permission_index !== null) {
|
|
188
|
+
lines.push(`Forward.permissionIndex: ${puzzle.permission.forward_permission_index}`);
|
|
189
|
+
}
|
|
190
|
+
lines.push(`Named operator short-circuit: ${puzzle.permission.uses_named_operator_short_circuit ? "YES" : "NO"}`);
|
|
191
|
+
lines.push(`Requires Passport: ${puzzle.permission.requires_passport ? "YES" : "NO"}`);
|
|
192
|
+
lines.push(`Uses order.has_op_permission: ${puzzle.permission.uses_order_permission ? "YES" : "NO"}`);
|
|
193
|
+
lines.push("");
|
|
194
|
+
}
|
|
195
|
+
const violations = validateConstraints(puzzle);
|
|
196
|
+
if (violations.length > 0) {
|
|
197
|
+
lines.push("─ Constraint Violations ──────────────");
|
|
198
|
+
for (const v of violations)
|
|
199
|
+
lines.push(` [${v.severity}] ${v.constraint_id}: ${v.message}`);
|
|
200
|
+
lines.push("");
|
|
201
|
+
}
|
|
202
|
+
return lines.join("\n");
|
|
203
|
+
}
|
|
204
|
+
export function resolveBuiltinPermission(index) {
|
|
205
|
+
return getBuiltinPermissionByIndex(index);
|
|
206
|
+
}
|
|
207
|
+
export function isOrderHolderForward(puzzle) {
|
|
208
|
+
return (puzzle.permission?.uses_named_operator_short_circuit === false &&
|
|
209
|
+
puzzle.permission?.forward_permission_index === null &&
|
|
210
|
+
puzzle.workflow?.use_order_variant === true);
|
|
211
|
+
}
|
|
212
|
+
export function getRelevantDimensions(action) {
|
|
213
|
+
const base = ["A", "B", "E", "F"];
|
|
214
|
+
if (action === "named_operator")
|
|
215
|
+
base.push("C");
|
|
216
|
+
if (action === "task_set")
|
|
217
|
+
base.push("D");
|
|
218
|
+
return base;
|
|
219
|
+
}
|