@wowok/agent-mcp 3.2.7 → 3.2.9
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/chain-semantics/field-capability.js +1 -1
- package/dist/chain-semantics/fund-flow.js +1 -1
- package/dist/chain-semantics/guard-verbs.js +1 -1
- package/dist/chain-semantics/object-graph.js +1 -1
- package/dist/composition/audit.js +1 -1
- package/dist/composition/compile.js +1 -1
- package/dist/composition/inflight.d.ts +10 -0
- package/dist/composition/inflight.js +1 -1
- package/dist/extensions/business-modules.d.ts +1 -1
- package/dist/extensions/business-modules.js +1 -1
- package/dist/graph/onchain/edge-schema.js +1 -1
- package/dist/harness/index.d.ts +1 -0
- package/dist/harness/index.js +1 -1
- package/dist/harness/operation-id.d.ts +1 -0
- package/dist/harness/operation-id.js +1 -0
- package/dist/harness/recover.js +1 -1
- package/dist/index.js +1 -1
- package/dist/knowledge/arbitration-ledger.js +1 -1
- package/dist/knowledge/audit-rules.js +1 -1
- package/dist/knowledge/baselines/rules/guard.json +96 -1
- package/dist/knowledge/baselines/rules/plan.json +30 -7
- package/dist/knowledge/baselines/semantic-facts.js +1 -1
- package/dist/knowledge/builtin-templates.d.ts +1 -1
- package/dist/knowledge/builtin-templates.js +1 -1
- package/dist/knowledge/discount-threshold.d.ts +11 -0
- package/dist/knowledge/discount-threshold.js +1 -1
- package/dist/knowledge/fund-layer.js +1 -1
- package/dist/knowledge/getting-started.js +1 -1
- package/dist/knowledge/guard-design-patterns.d.ts +1 -1
- package/dist/knowledge/guard-design-patterns.js +1 -1
- package/dist/knowledge/guard-field-cognition.js +1 -1
- package/dist/knowledge/guard-ledger.js +1 -1
- package/dist/knowledge/guard-lint.js +1 -1
- package/dist/knowledge/guard-render.js +1 -1
- package/dist/knowledge/guard-risk.d.ts +1 -0
- package/dist/knowledge/guard-risk.js +1 -1
- package/dist/knowledge/guard-submission-brief.d.ts +6 -0
- package/dist/knowledge/guard-submission-brief.js +1 -1
- package/dist/knowledge/guard-templates.d.ts +2 -2
- package/dist/knowledge/guard-templates.js +1 -1
- package/dist/knowledge/index.js +1 -1
- package/dist/knowledge/industry-registry.js +1 -1
- package/dist/knowledge/jsonrpc-enum.js +1 -1
- package/dist/knowledge/order-ledger.js +1 -1
- package/dist/knowledge/reward-ledger.js +1 -1
- package/dist/knowledge/safety-rules.js +1 -1
- package/dist/knowledge/template-loader.js +1 -1
- package/dist/knowledge/template-registry.js +1 -1
- package/dist/knowledge/template-scanner.d.ts +2 -0
- package/dist/knowledge/template-scanner.js +1 -1
- package/dist/knowledge/tool-constraints.js +1 -1
- package/dist/knowledge/workflow-guidance.d.ts +7 -3
- package/dist/knowledge/workflow-guidance.js +1 -1
- package/dist/monitor/MonitorLoop.js +1 -1
- package/dist/participation/radar-core.d.ts +1 -1
- package/dist/playbooks/service-build/business-puzzle.js +1 -1
- package/dist/playbooks/service-build/machine-panorama.js +1 -1
- package/dist/playbooks/service-build/merchant-guide.d.ts +8 -0
- package/dist/playbooks/service-build/merchant-guide.js +1 -1
- package/dist/playbooks/service-build/object-panorama.d.ts +28 -1
- package/dist/playbooks/service-build/object-panorama.js +1 -1
- package/dist/playbooks/service-build/participation-radar.d.ts +2 -0
- package/dist/playbooks/service-build/participation-radar.js +1 -1
- package/dist/playbooks/service-build/relationship-profile.js +1 -1
- package/dist/playbooks/service-build/reverse-mapping-nk4.spec.js +1 -1
- package/dist/playbooks/service-build/reverse-mapping.js +1 -1
- package/dist/playbooks/service-build/service-panorama.js +1 -1
- package/dist/playbooks/service-build/service-quote.js +1 -1
- package/dist/playbooks/service-build/service-quote.spec.js +1 -1
- package/dist/review/index.js +1 -1
- package/dist/safety/confirm-gate.js +1 -1
- package/dist/safety/preview.d.ts +1 -0
- package/dist/safety/preview.js +1 -1
- package/dist/schema/benchmark-migration/index.d.ts +14 -0
- package/dist/schema/benchmark-migration/index.js +1 -1
- package/dist/schema/call/allocation.d.ts +1 -1
- package/dist/schema/call/arbitration.d.ts +4 -4
- package/dist/schema/call/arbitration.js +1 -1
- package/dist/schema/call/base.d.ts +13 -5
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/call/bridge.d.ts +2 -0
- package/dist/schema/call/contact.d.ts +1 -1
- package/dist/schema/call/demand.d.ts +1 -1
- package/dist/schema/call/error-codes.d.ts +1 -1
- package/dist/schema/call/error-codes.js +1 -1
- package/dist/schema/call/guard.d.ts +3 -3
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/handler.js +1 -1
- package/dist/schema/call/machine.d.ts +1 -1
- package/dist/schema/call/machine.js +1 -1
- package/dist/schema/call/order.d.ts +1 -1
- package/dist/schema/call/order.js +1 -1
- package/dist/schema/call/permission.d.ts +1 -1
- package/dist/schema/call/personal.d.ts +4 -4
- package/dist/schema/call/progress.d.ts +1 -1
- package/dist/schema/call/progress.js +1 -1
- package/dist/schema/call/proof.js +1 -1
- package/dist/schema/call/repository.d.ts +5 -5
- package/dist/schema/call/repository.js +1 -1
- package/dist/schema/call/reward.d.ts +1 -1
- package/dist/schema/call/reward.js +1 -1
- package/dist/schema/call/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +4 -1
- package/dist/schema/call/service.js +1 -1
- package/dist/schema/call/treasury.d.ts +1 -1
- package/dist/schema/common/index.d.ts +4 -4
- package/dist/schema/common/index.js +1 -1
- package/dist/schema/goal/index.d.ts +12 -0
- package/dist/schema/goal/planning.d.ts +18 -0
- package/dist/schema/goal/planning.js +1 -1
- package/dist/schema/local/index.d.ts +21 -0
- package/dist/schema/local/index.js +1 -1
- package/dist/schema/messenger/index.js +1 -1
- package/dist/schema/operations.d.ts +22 -21
- package/dist/schema/query/bi.d.ts +6 -6
- package/dist/schema/query/bi.js +1 -1
- package/dist/schema/query/index.d.ts +112 -54
- package/dist/schema/query/index.js +1 -1
- package/dist/schema/schema-query/index.d.ts +1 -0
- package/dist/schema/schema-query/index.js +1 -1
- package/dist/schema/schema-version.js +1 -1
- package/dist/schema/utils/permission-machine-check.d.ts +2 -0
- package/dist/schema/utils/permission-machine-check.js +1 -1
- package/dist/schema/workflow/index.d.ts +1 -1
- package/dist/schema-query-impl/index.js +1 -1
- package/dist/schemas/account_operation.output.json +2 -0
- package/dist/schemas/account_operation.schema.json +3 -3
- package/dist/schemas/benchmark_migration_operation.output.json +42 -0
- package/dist/schemas/benchmark_migration_operation.schema.json +13 -0
- package/dist/schemas/bridge_operation.output.json +2 -0
- package/dist/schemas/goal_operation.schema.json +26 -0
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/local_cache_operation.output.json +2 -0
- package/dist/schemas/local_history_operation.output.json +2 -0
- package/dist/schemas/local_info_operation.output.json +2 -0
- package/dist/schemas/local_mark_operation.output.json +2 -0
- package/dist/schemas/messenger_operation.schema.json +4 -4
- package/dist/schemas/onchain_operations.output.json +7 -5
- package/dist/schemas/onchain_operations.schema.json +108 -92
- package/dist/schemas/onchain_operations_allocation.schema.json +5 -5
- package/dist/schemas/onchain_operations_arbitration.schema.json +10 -8
- package/dist/schemas/onchain_operations_contact.schema.json +6 -5
- package/dist/schemas/onchain_operations_demand.schema.json +6 -5
- package/dist/schemas/onchain_operations_gen_passport.schema.json +5 -5
- package/dist/schemas/onchain_operations_gen_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_guard.schema.json +4 -4
- package/dist/schemas/onchain_operations_machine.schema.json +7 -6
- package/dist/schemas/onchain_operations_order.schema.json +8 -7
- package/dist/schemas/onchain_operations_permission.schema.json +1 -0
- package/dist/schemas/onchain_operations_personal.schema.json +2 -2
- package/dist/schemas/onchain_operations_progress.schema.json +8 -7
- package/dist/schemas/onchain_operations_proof.schema.json +6 -6
- package/dist/schemas/onchain_operations_repository.schema.json +10 -9
- package/dist/schemas/onchain_operations_reward.schema.json +8 -7
- package/dist/schemas/onchain_operations_service.schema.json +16 -11
- package/dist/schemas/onchain_operations_treasury.schema.json +6 -5
- package/dist/schemas/onchain_table_data.output.json +7 -7
- package/dist/schemas/query_toolkit.output.json +31 -30
- package/dist/schemas/query_toolkit.schema.json +1 -1
- package/dist/schemas/schema_query.schema.json +4 -0
- package/dist/schemas/workflow_operation.schema.json +5 -5
- package/dist/schemas/wowok_buildin_info.output.json +140 -3
- package/dist/schemas/wowok_buildin_info.schema.json +2 -2
- package/dist/tools/handlers/benchmark-migration.d.ts +22 -1
- package/dist/tools/handlers/benchmark-migration.js +1 -1
- package/dist/tools/handlers/config.js +1 -1
- package/dist/tools/handlers/dispatch-expectations.d.ts +0 -1
- package/dist/tools/handlers/dispatch-expectations.js +1 -1
- package/dist/tools/handlers/local.js +1 -1
- package/dist/tools/handlers/onchain.js +1 -1
- package/dist/tools/handlers/query.d.ts +1 -0
- package/dist/tools/handlers/query.js +1 -1
- package/dist/tools/handlers/review-chain.js +1 -1
- package/dist/tools/handlers/schema-query.js +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/move-fn-index.gen.js +1 -1
- package/dist/tools/registry/files.js +1 -1
- package/dist/tools/registry/query.js +1 -1
- package/dist/tools/rules-hook.js +1 -1
- package/dist/tools/upgrade-check.d.ts +23 -0
- package/dist/tools/upgrade-check.js +1 -1
- package/dist/tools/wip-deploy-assist.d.ts +6 -0
- package/dist/tools/wip-deploy-assist.js +1 -1
- package/dist/tools/wrap.js +1 -1
- package/package.json +2 -2
|
@@ -389,6 +389,10 @@
|
|
|
389
389
|
"hasNextPage"
|
|
390
390
|
],
|
|
391
391
|
"additionalProperties": false
|
|
392
|
+
},
|
|
393
|
+
"_balance_scope_note": {
|
|
394
|
+
"description": "Semantic scope note for the balance figure: the total is aggregation-only; independently owned Coin objects may exist outside it. Follow the note (transaction digest or coin-objects query) before concluding funds arrived.",
|
|
395
|
+
"type": "string"
|
|
392
396
|
}
|
|
393
397
|
},
|
|
394
398
|
"additionalProperties": false,
|
|
@@ -942,7 +946,7 @@
|
|
|
942
946
|
"description": "vecvecu8"
|
|
943
947
|
}
|
|
944
948
|
],
|
|
945
|
-
"description": "User available value type (number
|
|
949
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
946
950
|
},
|
|
947
951
|
{
|
|
948
952
|
"type": "number",
|
|
@@ -3078,7 +3082,7 @@
|
|
|
3078
3082
|
"type": "null"
|
|
3079
3083
|
}
|
|
3080
3084
|
],
|
|
3081
|
-
"description": "Buyer-recorded credential that the required information was delivered via Wowok Messenger: the merchant's IM user address (resolved from the Service's Contact) or a WTS Proof object id (on-chain delivery proof embedding that IM address and timestamp)."
|
|
3085
|
+
"description": "Buyer-recorded credential that the required information was delivered via Wowok Messenger: the merchant's IM user address (resolved from the Service's Contact) or a WTS Proof object id (on-chain delivery proof embedding that IM address and timestamp). ATTESTATION-ONLY: the value is self-attested by the buyer, has no on-chain readback, and MUST NOT be used as a gate condition."
|
|
3082
3086
|
},
|
|
3083
3087
|
"time": {
|
|
3084
3088
|
"anyOf": [
|
|
@@ -3705,7 +3709,7 @@
|
|
|
3705
3709
|
"description": "vecvecu8"
|
|
3706
3710
|
}
|
|
3707
3711
|
],
|
|
3708
|
-
"description": "User available value type (number
|
|
3712
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
3709
3713
|
},
|
|
3710
3714
|
{
|
|
3711
3715
|
"type": "number",
|
|
@@ -5758,6 +5762,7 @@
|
|
|
5758
5762
|
"description": "Source of data ID when writing data. If None, user must specify the ID separately; if Clock, data ID is current timestamp; if Signer, data ID is user ID."
|
|
5759
5763
|
},
|
|
5760
5764
|
"value_type": {
|
|
5765
|
+
"description": "Type of data value when writing data. Note: 19 (Value) is an internal dynamic type for guard expressions and is NOT accepted here.",
|
|
5761
5766
|
"anyOf": [
|
|
5762
5767
|
{
|
|
5763
5768
|
"type": "number",
|
|
@@ -6044,8 +6049,7 @@
|
|
|
6044
6049
|
"const": "vecvecu8",
|
|
6045
6050
|
"description": "vecvecu8"
|
|
6046
6051
|
}
|
|
6047
|
-
]
|
|
6048
|
-
"description": "Type of data value when writing data. Note: 19 (Value) is an internal dynamic type for guard expressions and is NOT accepted here."
|
|
6052
|
+
]
|
|
6049
6053
|
}
|
|
6050
6054
|
},
|
|
6051
6055
|
"required": [
|
|
@@ -6329,6 +6333,7 @@
|
|
|
6329
6333
|
"description": "Whether this table item's value is submitted dynamically at Guard trigger time (alloc_by_guard call). \n\ntrue = value is submitted by the caller when triggering the Guard. Use for runtime-context-dependent values like order address, user address. The 'value' field is ignored when b_submission=true; the caller must provide it via submissions[]. \n\nfalse = value is static, set at Guard creation time. Use for values known when the Guard is created: expected node names, expected merchant address, expected service address. The 'value' field must be populated and will be stored on-chain permanently. \n\nRule of thumb: if the value is the SAME for all future Guard triggers, use false. If the value DIFFERS per trigger (e.g., which order to release funds for), use true."
|
|
6330
6334
|
},
|
|
6331
6335
|
"value_type": {
|
|
6336
|
+
"description": "Type of the value stored in `value`. One of: Bool(0), Address(1), String(2), U8(3), U16(4), U32(5), U64(6), U128(7), U256(8), VecBool(9), VecAddress(10), VecString(11), VecU8(12), VecU16(13), VecU32(14), VecU64(15), VecU128(16), VecU256(17), VecVecU8(18). When value_type=Address (1), the `value` field accepts a hex address string, a LocalMark name, or an AccountOrMark_Address object — see `value` field description for details.",
|
|
6332
6337
|
"anyOf": [
|
|
6333
6338
|
{
|
|
6334
6339
|
"type": "number",
|
|
@@ -6615,11 +6620,10 @@
|
|
|
6615
6620
|
"const": "vecvecu8",
|
|
6616
6621
|
"description": "vecvecu8"
|
|
6617
6622
|
}
|
|
6618
|
-
]
|
|
6619
|
-
"description": "Type of the value stored in `value`. One of: Bool(0), Address(1), String(2), U8(3), U16(4), U32(5), U64(6), U128(7), U256(8), VecBool(9), VecAddress(10), VecString(11), VecU8(12), VecU16(13), VecU32(14), VecU64(15), VecU128(16), VecU256(17), VecVecU8(18). When value_type=Address (1), the `value` field accepts a hex address string, a LocalMark name, or an AccountOrMark_Address object — see `value` field description for details."
|
|
6623
|
+
]
|
|
6620
6624
|
},
|
|
6621
6625
|
"value": {
|
|
6622
|
-
"description": "The actual value data. Format depends on `value_type`:\n• Bool: true/false (boolean)\n• Address (CRITICAL — string 'Address' is NOT a placeholder): a hex address (e.g. '0x1234...'), a LocalMark name (e.g. 'my-service' — resolved to address at evaluation time), an AccountOrMark_Address object (e.g. {name_or_address:'my-service'}), or system shorthand ('0xaaa' = EntityLinker, '0xaab' = EntityRegistrar). The literal string 'Address' itself is INVALID — it would be treated as a non-existent LocalMark name and fail. Example: value='0x2::wow::WOW<address>' or value='my-permission'.\n• String: any string\n• U8/U16/U32/U64/U128/U256: number or numeric string (e.g. 42 or '42')\n• Vec* types: arrays of the corresponding element type\nREQUIRED when b_submission=false. OPTIONAL when b_submission=true (value is supplied at evaluation time by user submission).",
|
|
6626
|
+
"description": "The actual value data. Format depends on `value_type`:\nTYPE-CLASS SPLIT (F03): scalar value_types (Bool/Address/String/U8..U256) take ONE scalar value (boolean/address string/name/string/number); Vec* value_types (VecBool/VecAddress/VecString/VecU8..VecU256) take a REAL JSON ARRAY of elements — a string (even a Python-repr-looking \"[a, b]\") fails serialization with 'value_type=10 (array) requires a array value'. The historical 'static values must be strings' rule applied to SCALARS only.\n• Bool: true/false (boolean)\n• Address (CRITICAL — string 'Address' is NOT a placeholder): a hex address (e.g. '0x1234...'), a LocalMark name (e.g. 'my-service' — resolved to address at evaluation time), an AccountOrMark_Address object (e.g. {name_or_address:'my-service'}), or system shorthand ('0xaaa' = EntityLinker, '0xaab' = EntityRegistrar). The literal string 'Address' itself is INVALID — it would be treated as a non-existent LocalMark name and fail. Example: value='0x2::wow::WOW<address>' or value='my-permission'.\n• String: any string\n• U8/U16/U32/U64/U128/U256: number or numeric string (e.g. 42 or '42')\n• Vec* types: arrays of the corresponding element type\nPROTOCOL SLOT 254 (once, b_submission Address): the submitted value MUST be the ORDER address bound to the operation (payment_info.for_object) — NEVER the Progress/Machine/Arb object the call is advancing. The chain asserts submission(254) == the order address; a Progress address fails the task binding and the forward aborts.\nREQUIRED when b_submission=false. OPTIONAL when b_submission=true (value is supplied at evaluation time by user submission).",
|
|
6623
6627
|
"anyOf": [
|
|
6624
6628
|
{
|
|
6625
6629
|
"type": "boolean"
|
|
@@ -7773,7 +7777,7 @@
|
|
|
7773
7777
|
"description": "vecvecu8"
|
|
7774
7778
|
}
|
|
7775
7779
|
],
|
|
7776
|
-
"description": "User available value type (number
|
|
7780
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
7777
7781
|
},
|
|
7778
7782
|
{
|
|
7779
7783
|
"type": "number",
|
|
@@ -10128,7 +10132,7 @@
|
|
|
10128
10132
|
"description": "vecvecu8"
|
|
10129
10133
|
}
|
|
10130
10134
|
],
|
|
10131
|
-
"description": "User available value type (number
|
|
10135
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
10132
10136
|
},
|
|
10133
10137
|
{
|
|
10134
10138
|
"type": "number",
|
|
@@ -10863,7 +10867,7 @@
|
|
|
10863
10867
|
"type": "null"
|
|
10864
10868
|
}
|
|
10865
10869
|
],
|
|
10866
|
-
"description": "About address
|
|
10870
|
+
"description": "About binding (K3 contract): the counterparty ACCOUNT address (address first byte = account type) or a Proof object address (first byte = Proof type) — a messenger contact record, NOT a business-object reference and never a guard decision condition"
|
|
10867
10871
|
},
|
|
10868
10872
|
"signer": {
|
|
10869
10873
|
"type": "string",
|
|
@@ -11550,7 +11554,7 @@
|
|
|
11550
11554
|
"description": "vecvecu8"
|
|
11551
11555
|
}
|
|
11552
11556
|
],
|
|
11553
|
-
"description": "User available value type (number
|
|
11557
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
11554
11558
|
},
|
|
11555
11559
|
{
|
|
11556
11560
|
"type": "number",
|
|
@@ -12539,7 +12543,7 @@
|
|
|
12539
12543
|
"description": "vecvecu8"
|
|
12540
12544
|
}
|
|
12541
12545
|
],
|
|
12542
|
-
"description": "User available value type (number
|
|
12546
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
12543
12547
|
},
|
|
12544
12548
|
{
|
|
12545
12549
|
"type": "number",
|
|
@@ -14896,7 +14900,7 @@
|
|
|
14896
14900
|
"description": "vecvecu8"
|
|
14897
14901
|
}
|
|
14898
14902
|
],
|
|
14899
|
-
"description": "User available value type (number
|
|
14903
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
14900
14904
|
},
|
|
14901
14905
|
{
|
|
14902
14906
|
"type": "number",
|
|
@@ -15566,7 +15570,7 @@
|
|
|
15566
15570
|
"type": "string"
|
|
15567
15571
|
},
|
|
15568
15572
|
"gas_used": {
|
|
15569
|
-
"description": "Total gas used (string, BigInt)",
|
|
15573
|
+
"description": "Total gas used (string, BigInt). F52: the node can report this NEGATIVE for some batch txs (e.g. batch-destroy) — a signed value is a direction marker, not a refund; take the absolute value when summing per-tx fees for reconciliation",
|
|
15570
15574
|
"type": "string"
|
|
15571
15575
|
},
|
|
15572
15576
|
"gas_budget": {
|
|
@@ -15811,7 +15815,7 @@
|
|
|
15811
15815
|
"type": "string"
|
|
15812
15816
|
},
|
|
15813
15817
|
"gas_used": {
|
|
15814
|
-
"description": "Gas used (string)",
|
|
15818
|
+
"description": "Gas used (string). F52: may be reported NEGATIVE for some batch txs — take the absolute value when reconciling fees",
|
|
15815
15819
|
"type": "string"
|
|
15816
15820
|
},
|
|
15817
15821
|
"objects_touched": {
|
|
@@ -15929,7 +15933,7 @@
|
|
|
15929
15933
|
"type": "string"
|
|
15930
15934
|
},
|
|
15931
15935
|
"gas_used": {
|
|
15932
|
-
"description": "Gas used (string)",
|
|
15936
|
+
"description": "Gas used (string). F52: may be reported NEGATIVE for some batch txs — take the absolute value when reconciling fees",
|
|
15933
15937
|
"type": "string"
|
|
15934
15938
|
},
|
|
15935
15939
|
"objects_touched": {
|
|
@@ -17123,14 +17127,13 @@
|
|
|
17123
17127
|
"description": "Input path inside the tool data payload."
|
|
17124
17128
|
},
|
|
17125
17129
|
"reason": {
|
|
17126
|
-
"
|
|
17127
|
-
"
|
|
17130
|
+
"description": "Chain-authoritative routing reason, including the Guard passport requirement when the forward binds one, and the standalone-Progress limitation for namedOperator='' forwards (abort 8 — no order payer). May be absent when the caller requested response_level 'compact', which trims templated routing prose from NON-recommended options (F44/docs#49).",
|
|
17131
|
+
"type": "string"
|
|
17128
17132
|
}
|
|
17129
17133
|
},
|
|
17130
17134
|
"required": [
|
|
17131
17135
|
"tool",
|
|
17132
|
-
"path"
|
|
17133
|
-
"reason"
|
|
17136
|
+
"path"
|
|
17134
17137
|
],
|
|
17135
17138
|
"additionalProperties": false
|
|
17136
17139
|
}
|
|
@@ -17570,14 +17573,13 @@
|
|
|
17570
17573
|
"description": "Input path inside the tool data payload."
|
|
17571
17574
|
},
|
|
17572
17575
|
"reason": {
|
|
17573
|
-
"
|
|
17574
|
-
"
|
|
17576
|
+
"description": "Chain-authoritative routing reason, including the Guard passport requirement when the forward binds one, and the standalone-Progress limitation for namedOperator='' forwards (abort 8 — no order payer). May be absent when the caller requested response_level 'compact', which trims templated routing prose from NON-recommended options (F44/docs#49).",
|
|
17577
|
+
"type": "string"
|
|
17575
17578
|
}
|
|
17576
17579
|
},
|
|
17577
17580
|
"required": [
|
|
17578
17581
|
"tool",
|
|
17579
|
-
"path"
|
|
17580
|
-
"reason"
|
|
17582
|
+
"path"
|
|
17581
17583
|
],
|
|
17582
17584
|
"additionalProperties": false
|
|
17583
17585
|
}
|
|
@@ -19110,14 +19112,13 @@
|
|
|
19110
19112
|
"description": "Input path inside the tool data payload."
|
|
19111
19113
|
},
|
|
19112
19114
|
"reason": {
|
|
19113
|
-
"
|
|
19114
|
-
"
|
|
19115
|
+
"description": "Chain-authoritative routing reason, including the Guard passport requirement when the forward binds one, and the standalone-Progress limitation for namedOperator='' forwards (abort 8 — no order payer). May be absent when the caller requested response_level 'compact', which trims templated routing prose from NON-recommended options (F44/docs#49).",
|
|
19116
|
+
"type": "string"
|
|
19115
19117
|
}
|
|
19116
19118
|
},
|
|
19117
19119
|
"required": [
|
|
19118
19120
|
"tool",
|
|
19119
|
-
"path"
|
|
19120
|
-
"reason"
|
|
19121
|
+
"path"
|
|
19121
19122
|
],
|
|
19122
19123
|
"additionalProperties": false
|
|
19123
19124
|
},
|
|
@@ -22895,7 +22896,7 @@
|
|
|
22895
22896
|
"description": "vecvecu8"
|
|
22896
22897
|
}
|
|
22897
22898
|
],
|
|
22898
|
-
"description": "User available value type (number
|
|
22899
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
22899
22900
|
},
|
|
22900
22901
|
{
|
|
22901
22902
|
"type": "number",
|
|
@@ -1098,7 +1098,7 @@
|
|
|
1098
1098
|
"query_type"
|
|
1099
1099
|
],
|
|
1100
1100
|
"additionalProperties": false,
|
|
1101
|
-
"description": "ONE-CALL detail-page panorama for Progress / Demand / Order / Arb / Repository / Proof objects (client panorama family): discriminated `object_type` + head (name/tags/description) + the object's own typed fields + type-specific extras (Demand presenters from the GLOBAL tx table, Progress session/forwards, Arb votes & propositions, Repository policies, Proof anchored root + WTS cross-check). Read-only."
|
|
1101
|
+
"description": "ONE-CALL detail-page panorama for Progress / Demand / Order / Allocation / Arb / Repository / Proof objects (client panorama family): discriminated `object_type` + head (name/tags/description) + the object's own typed fields + type-specific extras (Demand presenters from the GLOBAL tx table, Progress session/forwards, Order fund state, Allocation pool balance + per-rail resolved recipients + Payment children, Arb votes & propositions, Repository policies, Proof anchored root + WTS cross-check). Read-only."
|
|
1102
1102
|
},
|
|
1103
1103
|
{
|
|
1104
1104
|
"type": "object",
|
|
@@ -102,6 +102,10 @@
|
|
|
102
102
|
"mainnet",
|
|
103
103
|
"testnet"
|
|
104
104
|
]
|
|
105
|
+
},
|
|
106
|
+
"compare_with": {
|
|
107
|
+
"description": "ROUND-TRIP VERIFICATION (ZR-32/BKN-P5): an on-chain Guard ADDRESS or LocalMark name to diff the local JSON against. When set (with guard given as JSON forms 1/2), the live chain Guard is loaded and structurally diffed (tree node census, table row count, per-slot b_submission/value_type, rely) — any divergence is reported as an ERROR diagnostic and ready=false. Guards are create-frozen, so this is the only way to prove a local spec still matches what the chain actually stored.",
|
|
108
|
+
"type": "string"
|
|
105
109
|
}
|
|
106
110
|
},
|
|
107
111
|
"required": [
|
|
@@ -150,6 +150,7 @@
|
|
|
150
150
|
"description": "Whether this table item's value is submitted dynamically at Guard trigger time (alloc_by_guard call). \n\ntrue = value is submitted by the caller when triggering the Guard. Use for runtime-context-dependent values like order address, user address. The 'value' field is ignored when b_submission=true; the caller must provide it via submissions[]. \n\nfalse = value is static, set at Guard creation time. Use for values known when the Guard is created: expected node names, expected merchant address, expected service address. The 'value' field must be populated and will be stored on-chain permanently. \n\nRule of thumb: if the value is the SAME for all future Guard triggers, use false. If the value DIFFERS per trigger (e.g., which order to release funds for), use true."
|
|
151
151
|
},
|
|
152
152
|
"value_type": {
|
|
153
|
+
"description": "Type of the value stored in `value`. One of: Bool(0), Address(1), String(2), U8(3), U16(4), U32(5), U64(6), U128(7), U256(8), VecBool(9), VecAddress(10), VecString(11), VecU8(12), VecU16(13), VecU32(14), VecU64(15), VecU128(16), VecU256(17), VecVecU8(18). When value_type=Address (1), the `value` field accepts a hex address string, a LocalMark name, or an AccountOrMark_Address object — see `value` field description for details.",
|
|
153
154
|
"anyOf": [
|
|
154
155
|
{
|
|
155
156
|
"type": "number",
|
|
@@ -436,11 +437,10 @@
|
|
|
436
437
|
"const": "vecvecu8",
|
|
437
438
|
"description": "vecvecu8"
|
|
438
439
|
}
|
|
439
|
-
]
|
|
440
|
-
"description": "Type of the value stored in `value`. One of: Bool(0), Address(1), String(2), U8(3), U16(4), U32(5), U64(6), U128(7), U256(8), VecBool(9), VecAddress(10), VecString(11), VecU8(12), VecU16(13), VecU32(14), VecU64(15), VecU128(16), VecU256(17), VecVecU8(18). When value_type=Address (1), the `value` field accepts a hex address string, a LocalMark name, or an AccountOrMark_Address object — see `value` field description for details."
|
|
440
|
+
]
|
|
441
441
|
},
|
|
442
442
|
"value": {
|
|
443
|
-
"description": "The actual value data. Format depends on `value_type`:\n• Bool: true/false (boolean)\n• Address (CRITICAL — string 'Address' is NOT a placeholder): a hex address (e.g. '0x1234...'), a LocalMark name (e.g. 'my-service' — resolved to address at evaluation time), an AccountOrMark_Address object (e.g. {name_or_address:'my-service'}), or system shorthand ('0xaaa' = EntityLinker, '0xaab' = EntityRegistrar). The literal string 'Address' itself is INVALID — it would be treated as a non-existent LocalMark name and fail. Example: value='0x2::wow::WOW<address>' or value='my-permission'.\n• String: any string\n• U8/U16/U32/U64/U128/U256: number or numeric string (e.g. 42 or '42')\n• Vec* types: arrays of the corresponding element type\nREQUIRED when b_submission=false. OPTIONAL when b_submission=true (value is supplied at evaluation time by user submission).",
|
|
443
|
+
"description": "The actual value data. Format depends on `value_type`:\nTYPE-CLASS SPLIT (F03): scalar value_types (Bool/Address/String/U8..U256) take ONE scalar value (boolean/address string/name/string/number); Vec* value_types (VecBool/VecAddress/VecString/VecU8..VecU256) take a REAL JSON ARRAY of elements — a string (even a Python-repr-looking \"[a, b]\") fails serialization with 'value_type=10 (array) requires a array value'. The historical 'static values must be strings' rule applied to SCALARS only.\n• Bool: true/false (boolean)\n• Address (CRITICAL — string 'Address' is NOT a placeholder): a hex address (e.g. '0x1234...'), a LocalMark name (e.g. 'my-service' — resolved to address at evaluation time), an AccountOrMark_Address object (e.g. {name_or_address:'my-service'}), or system shorthand ('0xaaa' = EntityLinker, '0xaab' = EntityRegistrar). The literal string 'Address' itself is INVALID — it would be treated as a non-existent LocalMark name and fail. Example: value='0x2::wow::WOW<address>' or value='my-permission'.\n• String: any string\n• U8/U16/U32/U64/U128/U256: number or numeric string (e.g. 42 or '42')\n• Vec* types: arrays of the corresponding element type\nPROTOCOL SLOT 254 (once, b_submission Address): the submitted value MUST be the ORDER address bound to the operation (payment_info.for_object) — NEVER the Progress/Machine/Arb object the call is advancing. The chain asserts submission(254) == the order address; a Progress address fails the task binding and the forward aborts.\nREQUIRED when b_submission=false. OPTIONAL when b_submission=true (value is supplied at evaluation time by user submission).",
|
|
444
444
|
"anyOf": [
|
|
445
445
|
{
|
|
446
446
|
"type": "boolean"
|
|
@@ -599,7 +599,7 @@
|
|
|
599
599
|
"additionalProperties": false,
|
|
600
600
|
"description": "Guard table item (QUERY/OUTPUT form — includes auto-derived object_type field)"
|
|
601
601
|
},
|
|
602
|
-
"description": "User-submitted data matching the Guard's required fields. Relation: structure must match the Guard table's column definitions. Example: [{field:'delivery_proof', value:'Qm...'}]"
|
|
602
|
+
"description": "User-submitted data matching the Guard's required fields. Relation: structure must match the Guard table's column definitions. Example: [{field:'delivery_proof', value:'Qm...'}] PROTOCOL SLOT 254: when the Guard table has identifier 254, submit the ORDER address bound to the operation (payment_info.for_object) — never the Progress/Machine object being advanced."
|
|
603
603
|
}
|
|
604
604
|
},
|
|
605
605
|
"required": [
|
|
@@ -609,7 +609,7 @@
|
|
|
609
609
|
"additionalProperties": false,
|
|
610
610
|
"description": "One Guard's submission data: the Guard to verify plus the user-provided data that satisfies its requirements."
|
|
611
611
|
},
|
|
612
|
-
"description": "User-submitted data for each Guard. Relation: one entry per Guard in the guard array; fill submission fields and resubmit via call_with_submission. PLACEMENT: this `submission` field is at the SAME level as `data` and `env` in the operation input — NOT inside `data.data`. Example structure: {tool:'onchain_operations', data:{operation_type:'order', data:{object:'my_order', progress:{...}}}, submission:{type:'submission', guard:[...], submission:[...]}}"
|
|
612
|
+
"description": "User-submitted data for each Guard. Relation: one entry per Guard in the guard array; fill submission fields and resubmit via call_with_submission. SLOT COMPLETENESS (T8 az3-mn-261013): the submission array must cover EVERY b_submission slot in the Guard's table, not just one — a Guard whose table has multiple b_submission entries (e.g. slot 0 + slot 254) aborts on-chain with 'Submission ID not found' (abort 11) when any b_submission slot has no matching entry. Check the Guard's table (each entry with b_submission needs its identifier filled) and include ALL of them. PLACEMENT: this `submission` field is at the SAME level as `data` and `env` in the operation input — NOT inside `data.data`. Example structure: {tool:'onchain_operations', data:{operation_type:'order', data:{object:'my_order', progress:{...}}}, submission:{type:'submission', guard:[...], submission:[...]}}"
|
|
613
613
|
}
|
|
614
614
|
},
|
|
615
615
|
"required": [
|
|
@@ -517,7 +517,7 @@
|
|
|
517
517
|
"description": "vecvecu8"
|
|
518
518
|
}
|
|
519
519
|
],
|
|
520
|
-
"description": "User available value type (number
|
|
520
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
521
521
|
},
|
|
522
522
|
{
|
|
523
523
|
"type": "number",
|
|
@@ -866,7 +866,7 @@
|
|
|
866
866
|
"description": "vecvecu8"
|
|
867
867
|
}
|
|
868
868
|
],
|
|
869
|
-
"description": "User available value type (number
|
|
869
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
870
870
|
},
|
|
871
871
|
{
|
|
872
872
|
"type": "number",
|
|
@@ -1177,7 +1177,7 @@
|
|
|
1177
1177
|
"description": "vecvecu8"
|
|
1178
1178
|
}
|
|
1179
1179
|
],
|
|
1180
|
-
"description": "User available value type (number
|
|
1180
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
1181
1181
|
},
|
|
1182
1182
|
{
|
|
1183
1183
|
"type": "number",
|
|
@@ -1677,6 +1677,143 @@
|
|
|
1677
1677
|
"additionalProperties": false,
|
|
1678
1678
|
"description": "SDK runtime module health"
|
|
1679
1679
|
},
|
|
1680
|
+
"build_stamp": {
|
|
1681
|
+
"description": "Build identity stamp (M-K5 / CTR-B1/B5 + DEPLOY-K1 chain stamp): the per-round version surface a test harness must record; findings from a round whose stamp is missing or stale are not attributable to current code or a known chain state",
|
|
1682
|
+
"type": "object",
|
|
1683
|
+
"properties": {
|
|
1684
|
+
"builtin_templates_version": {
|
|
1685
|
+
"type": "number",
|
|
1686
|
+
"description": "Builtin industry template catalog version — the disk build-source contract (listTemplates hot-loads the disk tree); a test report must record this to claim it describes the current build"
|
|
1687
|
+
},
|
|
1688
|
+
"mcp_dist_stale": {
|
|
1689
|
+
"anyOf": [
|
|
1690
|
+
{
|
|
1691
|
+
"type": "object",
|
|
1692
|
+
"properties": {
|
|
1693
|
+
"stale": {
|
|
1694
|
+
"type": "boolean"
|
|
1695
|
+
},
|
|
1696
|
+
"lag_minutes": {
|
|
1697
|
+
"type": "number"
|
|
1698
|
+
}
|
|
1699
|
+
},
|
|
1700
|
+
"required": [
|
|
1701
|
+
"stale",
|
|
1702
|
+
"lag_minutes"
|
|
1703
|
+
],
|
|
1704
|
+
"additionalProperties": false
|
|
1705
|
+
},
|
|
1706
|
+
{
|
|
1707
|
+
"type": "null"
|
|
1708
|
+
}
|
|
1709
|
+
],
|
|
1710
|
+
"description": "MCP workspace src newer than its dist (null = no workspace src tree, installed build); stale=true means the process may run code older than its sources — rebuild before drawing conclusions"
|
|
1711
|
+
},
|
|
1712
|
+
"sdk_dist_stale": {
|
|
1713
|
+
"anyOf": [
|
|
1714
|
+
{
|
|
1715
|
+
"type": "object",
|
|
1716
|
+
"properties": {
|
|
1717
|
+
"stale": {
|
|
1718
|
+
"type": "boolean"
|
|
1719
|
+
},
|
|
1720
|
+
"lag_minutes": {
|
|
1721
|
+
"type": "number"
|
|
1722
|
+
}
|
|
1723
|
+
},
|
|
1724
|
+
"required": [
|
|
1725
|
+
"stale",
|
|
1726
|
+
"lag_minutes"
|
|
1727
|
+
],
|
|
1728
|
+
"additionalProperties": false
|
|
1729
|
+
},
|
|
1730
|
+
{
|
|
1731
|
+
"type": "null"
|
|
1732
|
+
}
|
|
1733
|
+
],
|
|
1734
|
+
"description": "SDK workspace src newer than its dist, same semantics (null = no workspace src tree)"
|
|
1735
|
+
},
|
|
1736
|
+
"chain_stamp": {
|
|
1737
|
+
"type": "object",
|
|
1738
|
+
"properties": {
|
|
1739
|
+
"network": {
|
|
1740
|
+
"anyOf": [
|
|
1741
|
+
{
|
|
1742
|
+
"type": "string"
|
|
1743
|
+
},
|
|
1744
|
+
{
|
|
1745
|
+
"type": "null"
|
|
1746
|
+
}
|
|
1747
|
+
]
|
|
1748
|
+
},
|
|
1749
|
+
"protocol_version": {
|
|
1750
|
+
"anyOf": [
|
|
1751
|
+
{
|
|
1752
|
+
"type": "string"
|
|
1753
|
+
},
|
|
1754
|
+
{
|
|
1755
|
+
"type": "null"
|
|
1756
|
+
}
|
|
1757
|
+
],
|
|
1758
|
+
"description": "Chain protocol version observed on the current network (null when the chain was unreachable)"
|
|
1759
|
+
},
|
|
1760
|
+
"system_state_version": {
|
|
1761
|
+
"anyOf": [
|
|
1762
|
+
{
|
|
1763
|
+
"type": "string"
|
|
1764
|
+
},
|
|
1765
|
+
{
|
|
1766
|
+
"type": "null"
|
|
1767
|
+
}
|
|
1768
|
+
],
|
|
1769
|
+
"description": "System state data-structure version observed (null when unreachable)"
|
|
1770
|
+
},
|
|
1771
|
+
"epoch": {
|
|
1772
|
+
"anyOf": [
|
|
1773
|
+
{
|
|
1774
|
+
"type": "string"
|
|
1775
|
+
},
|
|
1776
|
+
{
|
|
1777
|
+
"type": "null"
|
|
1778
|
+
}
|
|
1779
|
+
],
|
|
1780
|
+
"description": "Current epoch observed (null when unreachable)"
|
|
1781
|
+
},
|
|
1782
|
+
"fetched": {
|
|
1783
|
+
"type": "boolean",
|
|
1784
|
+
"description": "false when the chain was unreachable — the null fields then carry no meaning and must not be quoted"
|
|
1785
|
+
},
|
|
1786
|
+
"fetched_at": {
|
|
1787
|
+
"anyOf": [
|
|
1788
|
+
{
|
|
1789
|
+
"type": "string"
|
|
1790
|
+
},
|
|
1791
|
+
{
|
|
1792
|
+
"type": "null"
|
|
1793
|
+
}
|
|
1794
|
+
]
|
|
1795
|
+
}
|
|
1796
|
+
},
|
|
1797
|
+
"required": [
|
|
1798
|
+
"network",
|
|
1799
|
+
"protocol_version",
|
|
1800
|
+
"system_state_version",
|
|
1801
|
+
"epoch",
|
|
1802
|
+
"fetched",
|
|
1803
|
+
"fetched_at"
|
|
1804
|
+
],
|
|
1805
|
+
"additionalProperties": false,
|
|
1806
|
+
"description": "Chain-side attribution stamp (DEPLOY-K1): the chain generation this round actually exercised. Deployment-skew class (repo source ahead of the deployed chain — e.g. chain-side replay enforcement measured absent on mainnet) is detectable by recording this per test round; a report without it cannot claim to describe a specific chain state"
|
|
1807
|
+
}
|
|
1808
|
+
},
|
|
1809
|
+
"required": [
|
|
1810
|
+
"builtin_templates_version",
|
|
1811
|
+
"mcp_dist_stale",
|
|
1812
|
+
"sdk_dist_stale",
|
|
1813
|
+
"chain_stamp"
|
|
1814
|
+
],
|
|
1815
|
+
"additionalProperties": false
|
|
1816
|
+
},
|
|
1680
1817
|
"reminder": {
|
|
1681
1818
|
"type": "object",
|
|
1682
1819
|
"properties": {
|
|
@@ -452,7 +452,7 @@
|
|
|
452
452
|
"description": "vecvecu8"
|
|
453
453
|
}
|
|
454
454
|
],
|
|
455
|
-
"description": "User available value type (number
|
|
455
|
+
"description": "User available value type (number, numeric string, or name — e.g., 6, '6', 'U64', 'u64')"
|
|
456
456
|
},
|
|
457
457
|
{
|
|
458
458
|
"type": "number",
|
|
@@ -603,7 +603,7 @@
|
|
|
603
603
|
"info"
|
|
604
604
|
],
|
|
605
605
|
"additionalProperties": false,
|
|
606
|
-
"description": "Upgrade check - returns current vs latest npm versions of the WoWok MCP server and SDK, whether the WoWok desktop client is installed, SDK runtime module health (detects the stale-chunk failure class that version comparison cannot see), and whether an upgrade/install/restart reminder is due. Call at the start of a conversation to decide whether to remind the user to upgrade, install the client, or restart the MCP server."
|
|
606
|
+
"description": "Upgrade check - returns current vs latest npm versions of the WoWok MCP server and SDK, whether the WoWok desktop client is installed, SDK runtime module health (detects the stale-chunk failure class that version comparison cannot see), a build_stamp (template catalog version, src-vs-dist staleness, and a chain-side attribution stamp for the current network), and whether an upgrade/install/restart reminder is due. Call at the start of a conversation to decide whether to remind the user to upgrade, install the client, or restart the MCP server, and record build_stamp in any test round so findings are attributable."
|
|
607
607
|
},
|
|
608
608
|
{
|
|
609
609
|
"type": "object",
|
|
@@ -1,8 +1,29 @@
|
|
|
1
1
|
import { validateAllocatorRows, type IndustryTemplate } from "../../knowledge/template-loader.js";
|
|
2
|
+
import { type TemplateScanResult } from "../../knowledge/template-scanner.js";
|
|
2
3
|
import type { DeliverableDefinition } from "../../playbooks/service-build/intent-analyzer.js";
|
|
3
4
|
import type { IndustryMode } from "../../extensions/index.js";
|
|
4
5
|
import type { ToolDispatchResult } from "../types.js";
|
|
5
|
-
|
|
6
|
+
declare function scanSummary(scan: TemplateScanResult): {
|
|
7
|
+
risk_level: import("../../knowledge/template-scanner.js").TemplateRiskLevel;
|
|
8
|
+
passed: boolean;
|
|
9
|
+
finding_count: number;
|
|
10
|
+
findings_by_severity: Record<string, number>;
|
|
11
|
+
red_flags: string[];
|
|
12
|
+
findings: import("../../knowledge/template-scanner.js").TemplateScanFinding[];
|
|
13
|
+
};
|
|
14
|
+
export declare function buildVerdict(summary: ReturnType<typeof scanSummary>, plan: Record<string, unknown>): {
|
|
15
|
+
buildable: boolean;
|
|
16
|
+
blockers: string[];
|
|
17
|
+
};
|
|
18
|
+
export declare function planNextAction(plan: Record<string, unknown>, retryAction: string, verdict?: {
|
|
19
|
+
buildable: boolean;
|
|
20
|
+
blockers: string[];
|
|
21
|
+
}): string;
|
|
22
|
+
export interface RewardPoolPrefill {
|
|
23
|
+
fee_key: "review_reward_pool";
|
|
24
|
+
value: number;
|
|
25
|
+
}
|
|
26
|
+
export declare function extractRewardPoolCandidate(description: string | undefined): number | undefined;
|
|
6
27
|
export { validateAllocatorRows };
|
|
7
28
|
export declare function variantPaymentModel(t: IndustryTemplate): "milestone" | "subscription" | "escrow";
|
|
8
29
|
export declare function variantDeliverables(t: IndustryTemplate, traits: IndustryMode["traits"] | undefined): DeliverableDefinition[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{strictParse}from'../../schema/index.js';import{BenchmarkMigrationSchema}from'../../schema/benchmark-migration/index.js';import{getTemplate,listTemplates,validateAllocatorRows,platformShareBps}from'../../knowledge/template-loader.js';import{scanTemplate,buildFeeParamLandingTable}from'../../knowledge/template-scanner.js';import{planMigration}from'../../playbooks/service-build/migration-planner.js';import{handleMerchantGuide}from'../../playbooks/service-build/merchant-guide.js';import{inferArbitration}from'../../playbooks/service-build/intent-analyzer.js';import{getIndustryModeRegistry}from'../../extensions/index.js';import{resolveIndustryName}from'../../knowledge/industry-registry.js';function templateSummary(a){return{'id':a['id'],'industry':a['industry'],'variant':a['variant'],'product_ref':a['product_ref'],'archetype':a['archetype'],'key_risk':a['key_risk'],'node_count':a['machine_shape']['length'],'guard_count':a['guards']['length'],'recommended_role':a['recommended_role']};}function requireTemplate(a,b){if(!a)throw new Error('\x27template_id\x27\x20is\x20required\x20for\x20action=\x27'+b+'\x27');const c=getTemplate(a);if(!c)throw new Error('Unknown\x20template\x20id:\x20'+a+'\x20(use\x20action=\x27template_list\x27\x20to\x20see\x20valid\x20ids)');return c;}function scanSummary(a){const b={};for(const c of a['findings'])b[c['severity']]=(b[c['severity']]??0x0)+0x1;return{'risk_level':a['risk_level'],'passed':a['passed'],'finding_count':a['findings']['length'],'findings_by_severity':b,'red_flags':a['red_flags'],'findings':a['findings']};}function assertScanPassed(a,b){if(a['passed'])return;throw new Error('action=\x27'+b+'\x27\x20blocked:\x20pre-deploy\x20scan\x20of\x20template\x20\x27'+a['template_id']+'\x27\x20found\x20CRITICAL\x20risk\x20—\x20'+a['red_flags']['join'](';\x20')+'.\x20Fix\x20the\x20template\x20(frontmatter\x20or\x20body)\x20and\x20re-run\x20action=\x27template_scan\x27.');}export function planNextAction(a,b){const c=a['next_action'];if(typeof c==='string'&&c['startsWith']('Plan\x20ready.'))return c;const d=Array['isArray'](a['pending_guard_designs'])?a['pending_guard_designs']['length']:0x0;return'Plan\x20BLOCKED\x20by\x20the\x20guide\x20audit\x20(see\x20plan.audit\x20/\x20plan.next_action).\x20Do\x20NOT\x20materialize,\x20'+'and\x20do\x20NOT\x20hand-build\x20the\x20objects\x20instead:\x20this\x20plan\x20is\x20the\x20wiring\x20authority\x20(Arbitration\x20+\x20'+'compensation-fund,\x20Contact/um,\x20allocator\x20rows)\x20and\x20hand-built\x20replicas\x20silently\x20drop\x20those\x20wirings.\x20'+(d>0x0?'Resolve\x20the\x20'+d+'\x20pending\x20guard\x20design(s)\x20in\x20plan.pending_guard_designs\x20via\x20guard_resolutions\x20(kind\x20\x27inline\x27\x20with\x20the\x20Guard\x20table+root,\x20or\x20kind\x20\x27template\x27\x20with\x20a\x20tpl_*\x20id),\x20':'Adjust\x20fee_overrides,\x20pick\x20another\x20template\x20variant,\x20or\x20fix\x20the\x20template,\x20')+('then\x20re-run\x20action=\x27'+b+'\x27.');}function templateIntent(a,b){if(b&&b['trim']())return b['trim']();return'Adopt\x20the\x20'+a['id']+'\x20industry\x20archetype\x20template\x20('+a['archetype']+')\x20for\x20the\x20'+a['industry']+'\x20industry.\x20'+('Primary\x20risk\x20to\x20mitigate:\x20'+a['key_risk']+'.');}function effectiveFeeParams(a,b){return{...a['fee_params'],...b??{}};}function validateFeeParams(a,b){const c=[];let d=0x0;for(const [e,f]of Object['entries'](a)){if(typeof f!=='number'||!Number['isFinite'](f))continue;if(e['endsWith']('_bps')){(!Number['isInteger'](f)||f<0x0||f>0x2710)&&c['push'](e+'='+f+'\x20is\x20not\x20an\x20integer\x20rate\x20in\x20[0,\x2010000]\x20bps');if(e['endsWith']('_share_bps'))d+=Math['max'](0x0,f);}else{if(e['endsWith']('_days')){if(f<=0x0||f>0xe42)c['push'](e+'='+f+'\x20is\x20outside\x20the\x20sane\x20window\x20range\x20(0,\x203650]\x20days');}else{if(e['endsWith']('_hours')){if(f<=0x0||f>0x2238)c['push'](e+'='+f+'\x20is\x20outside\x20the\x20sane\x20window\x20range\x20(0,\x208760]\x20hours');}}}}if(d>0x2710)c['push']('*_share_bps\x20sum\x20'+d+'\x20exceeds\x2010000\x20(a\x20pool\x20splits\x20into\x20at\x20most\x20100%)');if(c['length']>0x0)throw new Error('invalid\x20fee\x20parameters\x20for\x20template\x20\x27'+b+'\x27:\x20'+c['join'](';\x20')+'.\x20'+'Correct\x20the\x20template\x27s\x20fee_params\x20or\x20pass\x20valid\x20\x27fee_overrides\x27.');}export{validateAllocatorRows};export function variantPaymentModel(a){if(a['payment_model'])return a['payment_model'];const b=a['allocator']['rows']??[];if(b['some'](d=>d['track']==='refund'))return'escrow';const c=a['machine_shape']['map'](d=>d['name'])['join']('\x20')['toLowerCase']();if(/\b(milestone|revision|revis|draft|deliverable)\b/['test'](c))return'milestone';if(/\b(charge|renew|subscription|cycle|billing|monthly)\b/['test'](c))return'subscription';return'escrow';}function variantRefundPolicy(a){const b=a['allocator']['description']['toLowerCase']();if(/full[ -]?refund|100% refund|refund .*100/['test'](b))return'full';if(/pro-?rata|prorated/['test'](b))return'milestone_prorated';if(/partial/['test'](b))return'partial';return undefined;}export function variantDeliverables(a,b){const c=a['machine_shape']['filter'](g=>g['semantic_role']==='final'),d=c[c['length']-0x1]??[...a['machine_shape']]['reverse']()['find'](g=>!/refund|cancel|dispute|terminat/i['test'](g['name']+'\x20'+g['role']))??a['machine_shape'][a['machine_shape']['length']-0x1],e=b?.['has_logistics']?'physical':b?.['pure_digital']?'digital':'service_session',f=(a['guards']??[])['filter'](h=>/repository_data_check|required_info_evidence_gate|allocator_order_anchor/['test'](h['template_id']));return[{'name':a['variant']+'\x20fulfillment','type':e,'acceptanceCriteria':'Order\x20reaches\x20the\x20terminal\x20workflow\x20node\x20\x27'+d['name']+'\x27\x20('+d['role']+')','proofOfDelivery':f['length']>0x0?'wip_hash':'manual_confirm'}];}function validateConditionalParams(a,b){for(const d of a['conditional_guards']??[]){const e=b[d['param']];if(e===undefined)continue;if(typeof e!=='string'||!d['values']['includes'](e))throw new Error('invalid\x20\x27'+d['param']+'='+String(e)+'\x27\x20for\x20template\x20\x27'+a['id']+'\x27:\x20must\x20be\x20one\x20of\x20'+d['values']['map'](f=>'\x27'+f+'\x27')['join']('\x20|\x20')+('\x20(the\x20guard\x20variant\x20mounts\x20at\x20\x27'+d['emit_value']+'\x27)'));}}async function runGuide(a,b,c,d){const e=effectiveFeeParams(a,c);validateFeeParams(e,a['id']),validateConditionalParams(a,e);const f=getIndustryModeRegistry()['getMode'](a['industry']),g=platformShareBps(e),h={'model':variantPaymentModel(a)},i=[],j=(a['allocator']['rows']?.['length']??0x0)>0x0;if(g!==undefined&&g>0x0&&!j&&a['allocator']['mode']==='rate'){const n=Math['round'](g)/0x64;i['push']({'recipient':'merchant','percentage':Math['round']((0x64-n)*0x64)/0x64}),i['push']({'recipient':'platform','percentage':n}),h['allocation']=i;}const k=variantRefundPolicy(a),l={'escrow':!![]};if(k)l['refundPolicy']=k;l['arbitration']=a['arbitration_mode']??l['arbitration']??inferArbitration(templateIntent(a,b));const m=await handleMerchantGuide({'intent':templateIntent(a,b),'guide_confirm':{'industry':a['industry'],'payment':h,'trust':l,'deliverables':variantDeliverables(a,f?.['traits']),...d&&Object['keys'](d)['length']>0x0?{'guard_resolutions':d}:{}},'template_override':{...a,'fee_params':e},'name_base':a['id']});if(a['allocator']['rows']?.['length'])m['template_allocator_rows']=a['allocator']['rows']['map'](o=>({...o}));m['template']={'id':a['id'],'archetype':a['archetype'],'recommended_role':a['recommended_role'],'fee_params':e},m['template_fee_param_landings']=buildFeeParamLandingTable(a,e);if(c&&Object['keys'](c)['length']>0x0)m['template_fee_overrides']=c;return m;}export async function handleBenchmarkMigrationOperation(a){const b=strictParse(BenchmarkMigrationSchema,a,'benchmark_migration_operation\x20input'),c=b['industry']?resolveIndustryName(b['industry'])??b['industry']['toLowerCase']():undefined;let d;switch(b['action']){case'template_list':{const {templates:e,errors:f}=listTemplates(),g=c?e['filter'](h=>h['industry']===c):e;d={'action':'template_list','count':g['length'],'templates':g['map'](templateSummary),'load_errors':f};break;}case'template_get':{const h=requireTemplate(b['template_id'],'template_get');d={'action':'template_get','template':{...h}};break;}case'template_generate':{const i=requireTemplate(b['template_id'],'template_generate'),j=scanTemplate(i);assertScanPassed(j,'template_generate');const k=await runGuide(i,b['description'],b['fee_overrides'],b['guard_resolutions']);d={'action':'template_generate','template_id':i['id'],'scan':scanSummary(j),'plan':k,'next_action':planNextAction(k,'template_generate')};break;}case'template_scan':{const l=requireTemplate(b['template_id'],'template_scan');d={'action':'template_scan','scan':scanTemplate(l)};break;}case'migration_import':{if(!b['description']||!b['description']['trim']())throw new Error('\x27description\x27\x20is\x20required\x20for\x20action=\x27migration_import\x27');const m=planMigration({'url':b['url'],'description':b['description'],'industry':c,'network':b['network']});if(!m)throw new Error('No\x20industry\x20template\x20matched\x20the\x20description.\x20Refine\x20the\x20description\x20or\x20pass\x20an\x20explicit\x20\x27industry\x27\x20hint.');d={'action':'migration_import','log':m,'next_action':'MigrationLog\x20ready.\x20Next:\x20call\x20action=\x27migration_review\x27\x20with\x20this\x20log\x20to\x20surface\x20the\x20mapped/unmapped/manual_review\x20items\x20for\x20user\x20confirmation.'};break;}case'migration_review':{if(!b['log'])throw new Error('\x27log\x27\x20is\x20required\x20for\x20action=\x27migration_review\x27');const n=b['log'],o=Array['isArray'](n['mapped'])?n['mapped']:[],p=Array['isArray'](n['unmapped'])?n['unmapped']:[],q=Array['isArray'](n['manual_review'])?n['manual_review']:[],r=n['risk_check']??{},s=n['source']?.['matched_template']??'',t=p['length']===0x0&&q['length']===0x0&&r['passed']===!![];d={'action':'migration_review','log':n,'review_summary':{'mapped_count':o['length'],'unmapped_count':p['length'],'manual_review_count':q['length'],'risk_passed':r['passed']===!![]},'next_action':t?'Review\x20clean.\x20Proceed:\x20call\x20action=\x27migration_apply\x27\x20with\x20template_id=\x27'+s+'\x27\x20to\x20produce\x20the\x20creation\x20plan\x20(network\x20defaults\x20to\x20testnet;\x20mainnet\x20requires\x20explicit\x20user\x20confirmation).':'Surface\x20the\x20'+p['length']+'\x20unmapped\x20and\x20'+q['length']+'\x20manual_review\x20items'+(r['passed']===!![]?'':'\x20plus\x20the\x20risk_check\x20findings')+'\x20to\x20the\x20user\x20for\x20a\x20decision\x20before\x20action=\x27migration_apply\x27\x20(template_id=\x27'+s+'\x27).'};break;}case'migration_apply':{const u=requireTemplate(b['template_id'],'migration_apply'),v=scanTemplate(u);assertScanPassed(v,'migration_apply');const w=b['network']??'testnet',x=await runGuide(u,b['description'],b['fee_overrides'],b['guard_resolutions']);d={'action':'migration_apply','template_id':u['id'],'network':w,'scan':scanSummary(v),'plan':x,'next_action':planNextAction(x,'migration_apply')};break;}default:throw new Error('Unknown\x20benchmark_migration_operation\x20action:\x20'+String(b['action']));}return{'content':[{'type':'text','text':JSON['stringify']({'result':d})}],'structuredContent':{'result':d}};}
|
|
1
|
+
import{strictParse}from'../../schema/index.js';import{BenchmarkMigrationSchema}from'../../schema/benchmark-migration/index.js';import{getTemplate,listTemplates,validateAllocatorRows,platformShareBps}from'../../knowledge/template-loader.js';import{scanTemplate,buildFeeParamLandingTable}from'../../knowledge/template-scanner.js';import{planMigration}from'../../playbooks/service-build/migration-planner.js';import{handleMerchantGuide}from'../../playbooks/service-build/merchant-guide.js';import{inferArbitration}from'../../playbooks/service-build/intent-analyzer.js';import{getIndustryModeRegistry}from'../../extensions/index.js';import{resolveIndustryName}from'../../knowledge/industry-registry.js';function templateSummary(a){return{'id':a['id'],'industry':a['industry'],'variant':a['variant'],'product_ref':a['product_ref'],'archetype':a['archetype'],'key_risk':a['key_risk'],'node_count':a['machine_shape']['length'],'guard_count':a['guards']['length'],'recommended_role':a['recommended_role']};}function requireTemplate(a,b){if(!a)throw new Error('\x27template_id\x27\x20is\x20required\x20for\x20action=\x27'+b+'\x27');const c=getTemplate(a);if(!c)throw new Error('Unknown\x20template\x20id:\x20'+a+'\x20(use\x20action=\x27template_list\x27\x20to\x20see\x20valid\x20ids)');return c;}function scanSummary(a){const b={};for(const c of a['findings'])b[c['severity']]=(b[c['severity']]??0x0)+0x1;return{'risk_level':a['risk_level'],'passed':a['passed'],'finding_count':a['findings']['length'],'findings_by_severity':b,'red_flags':a['red_flags'],'findings':a['findings']};}function assertScanPassed(a,b){if(a['passed'])return;throw new Error('action=\x27'+b+'\x27\x20blocked:\x20pre-deploy\x20scan\x20of\x20template\x20\x27'+a['template_id']+'\x27\x20found\x20CRITICAL\x20risk\x20—\x20'+a['red_flags']['join'](';\x20')+'.\x20Fix\x20the\x20template\x20(frontmatter\x20or\x20body)\x20and\x20re-run\x20action=\x27template_scan\x27.');}export function buildVerdict(a,b){const c=[];!a['passed']&&c['push']('scan:\x20'+(a['findings_by_severity']['critical']??0x0)+'\x20CRITICAL\x20finding(s)\x20(scan.passed=false)');const d=b['graph_validation'];if(d&&d['valid']===![]){const f=Array['isArray'](d['hard_violations'])?d['hard_violations']['length']:0x0,g=Array['isArray'](d['hard_violations'])?d['hard_violations']['map'](h=>h['id'])['join'](',\x20'):'';c['push']('graph_validation:\x20'+f+'\x20hard\x20violation(s)'+(g?'\x20('+g+')':''));}const e=b['audit'];return e&&e['blocking']===!![]&&c['push']('audit:\x20guide\x20audit\x20flagged\x20blocking\x20issue(s)\x20(plan.audit)'),{'buildable':c['length']===0x0,'blockers':c};}export function planNextAction(a,b,c){const d=a['next_action'];if(typeof d==='string'&&d['startsWith']('Plan\x20ready.'))return d;if(c?.['buildable']){const f=Array['isArray'](a['pending_guard_designs'])?a['pending_guard_designs']['length']:0x0;return'Plan\x20is\x20buildable\x20(verdict.buildable=true).\x20Materialize\x20the\x20objects\x20in\x20plan.steps\x20order'+(f>0x0?',\x20resolving\x20the\x20'+f+'\x20pending\x20guard\x20design(s)\x20in\x20plan.pending_guard_designs\x20via\x20guard_resolutions\x20before\x20the\x20Machine\x20publish':'')+'.';}const e=Array['isArray'](a['pending_guard_designs'])?a['pending_guard_designs']['length']:0x0;return'Plan\x20BLOCKED\x20by\x20the\x20guide\x20audit\x20(see\x20plan.audit\x20/\x20plan.next_action).\x20Do\x20NOT\x20materialize,\x20'+'and\x20do\x20NOT\x20hand-build\x20the\x20objects\x20instead:\x20this\x20plan\x20is\x20the\x20wiring\x20authority\x20(Arbitration\x20+\x20'+'compensation-fund,\x20Contact/um,\x20allocator\x20rows)\x20and\x20hand-built\x20replicas\x20silently\x20drop\x20those\x20wirings.\x20'+(e>0x0?'Resolve\x20the\x20'+e+'\x20pending\x20guard\x20design(s)\x20in\x20plan.pending_guard_designs\x20via\x20guard_resolutions\x20(kind\x20\x27inline\x27\x20with\x20the\x20Guard\x20table+root,\x20or\x20kind\x20\x27template\x27\x20with\x20a\x20tpl_*\x20id),\x20':'Adjust\x20fee_overrides,\x20pick\x20another\x20template\x20variant,\x20or\x20fix\x20the\x20template,\x20')+('then\x20re-run\x20action=\x27'+b+'\x27.');}function templateIntent(a,b){if(b&&b['trim']())return b['trim']();return'Adopt\x20the\x20'+a['id']+'\x20industry\x20archetype\x20template\x20('+a['archetype']+')\x20for\x20the\x20'+a['industry']+'\x20industry.\x20'+('Primary\x20risk\x20to\x20mitigate:\x20'+a['key_risk']+'.');}function effectiveFeeParams(a,b){return{...a['fee_params'],...b??{}};}const REWARD_POOL_PATTERNS=[/(?:reward|review|bonus|tip|prize)[\s-]*pools?\s*(?:of|is|at|:|=)?\s*([0-9][0-9_,]*(?:\.[0-9]+)?)/i,/([0-9][0-9_,]*(?:\.[0-9]+)?)\s*(?:reward|review|bonus|tip|prize)[\s-]*pools?\b/i,/(?:奖(?:金|励)?池|打赏池|好评(?:奖励)?池)\s*(?:为|是|:|:|=)?\s*([0-9][0-9_,]*(?:\.[0-9]+)?)/,/([0-9][0-9_,]*(?:\.[0-9]+)?)\s*的?\s*(?:奖(?:金|励)?池|打赏池|好评(?:奖励)?池)/];export function extractRewardPoolCandidate(a){if(!a)return undefined;for(const b of REWARD_POOL_PATTERNS){const c=b['exec'](a);if(!c)continue;const d=Number(c[0x1]['replaceAll'](/[,_]/g,''));if(Number['isFinite'](d)&&d>=0x0)return d;}return undefined;}function rewardPoolPrefill(a,b,c){if(a['fee_params']['review_reward_pool']===undefined)return undefined;if(c?.['review_reward_pool']!==undefined)return undefined;const d=extractRewardPoolCandidate(b);return d===undefined?undefined:{'fee_key':'review_reward_pool','value':d};}function validateFeeParams(a,b){const c=[];let d=0x0;for(const [e,f]of Object['entries'](a)){if(typeof f!=='number'||!Number['isFinite'](f))continue;if(e['endsWith']('_bps')){(!Number['isInteger'](f)||f<0x0||f>0x2710)&&c['push'](e+'='+f+'\x20is\x20not\x20an\x20integer\x20rate\x20in\x20[0,\x2010000]\x20bps');if(e['endsWith']('_share_bps'))d+=Math['max'](0x0,f);}else{if(e['endsWith']('_days')){if(f<=0x0||f>0xe42)c['push'](e+'='+f+'\x20is\x20outside\x20the\x20sane\x20window\x20range\x20(0,\x203650]\x20days');}else{if(e['endsWith']('_hours')){if(f<=0x0||f>0x2238)c['push'](e+'='+f+'\x20is\x20outside\x20the\x20sane\x20window\x20range\x20(0,\x208760]\x20hours');}}}}if(d>0x2710)c['push']('*_share_bps\x20sum\x20'+d+'\x20exceeds\x2010000\x20(a\x20pool\x20splits\x20into\x20at\x20most\x20100%)');if(c['length']>0x0)throw new Error('invalid\x20fee\x20parameters\x20for\x20template\x20\x27'+b+'\x27:\x20'+c['join'](';\x20')+'.\x20'+'Correct\x20the\x20template\x27s\x20fee_params\x20or\x20pass\x20valid\x20\x27fee_overrides\x27.');}export{validateAllocatorRows};export function variantPaymentModel(a){if(a['payment_model'])return a['payment_model'];const b=a['allocator']['rows']??[];if(b['some'](d=>d['track']==='refund'))return'escrow';const c=a['machine_shape']['map'](d=>d['name'])['join']('\x20')['toLowerCase']();if(/\b(milestone|revision|revis|draft|deliverable)\b/['test'](c))return'milestone';if(/\b(charge|renew|subscription|cycle|billing|monthly)\b/['test'](c))return'subscription';return'escrow';}function variantRefundPolicy(a){const b=a['allocator']['description']['toLowerCase']();if(/full[ -]?refund|100% refund|refund .*100/['test'](b))return'full';if(/pro-?rata|prorated/['test'](b))return'milestone_prorated';if(/partial/['test'](b))return'partial';return undefined;}export function variantDeliverables(a,b){const c=a['machine_shape']['filter'](g=>g['semantic_role']==='final'),d=c[c['length']-0x1]??[...a['machine_shape']]['reverse']()['find'](g=>!/refund|cancel|dispute|terminat/i['test'](g['name']+'\x20'+g['role']))??a['machine_shape'][a['machine_shape']['length']-0x1],e=b?.['has_logistics']?'physical':b?.['pure_digital']?'digital':'service_session',f=(a['guards']??[])['filter'](h=>/repository_data_check|required_info_evidence_gate|allocator_order_anchor/['test'](h['template_id']));return[{'name':a['variant']+'\x20fulfillment','type':e,'acceptanceCriteria':'Order\x20reaches\x20the\x20terminal\x20workflow\x20node\x20\x27'+d['name']+'\x27\x20('+d['role']+')','proofOfDelivery':f['length']>0x0?'wip_hash':'manual_confirm'}];}function validateConditionalParams(a,b){for(const d of a['conditional_guards']??[]){const e=b[d['param']];if(e===undefined)continue;if(typeof e!=='string'||!d['values']['includes'](e))throw new Error('invalid\x20\x27'+d['param']+'='+String(e)+'\x27\x20for\x20template\x20\x27'+a['id']+'\x27:\x20must\x20be\x20one\x20of\x20'+d['values']['map'](f=>'\x27'+f+'\x27')['join']('\x20|\x20')+('\x20(the\x20guard\x20variant\x20mounts\x20at\x20\x27'+d['emit_value']+'\x27)'));}}async function runGuide(a,b,c,d,e){const f=effectiveFeeParams(a,c),g=rewardPoolPrefill(a,b,c);if(g)f[g['fee_key']]=g['value'];validateFeeParams(f,a['id']),validateConditionalParams(a,f);const h=getIndustryModeRegistry()['getMode'](a['industry']),i=platformShareBps(f),j={'model':variantPaymentModel(a)},k=[],l=(a['allocator']['rows']?.['length']??0x0)>0x0;if(i!==undefined&&i>0x0&&!l&&a['allocator']['mode']==='rate'){const p=Math['round'](i)/0x64;k['push']({'recipient':'merchant','percentage':Math['round']((0x64-p)*0x64)/0x64}),k['push']({'recipient':'platform','percentage':p}),j['allocation']=k;}const m=variantRefundPolicy(a),n={'escrow':!![]};if(m)n['refundPolicy']=m;n['arbitration']=a['arbitration_mode']??n['arbitration']??inferArbitration(templateIntent(a,b));const o=await handleMerchantGuide({'intent':templateIntent(a,b),'guide_confirm':{'industry':a['industry'],'payment':j,'trust':n,'deliverables':variantDeliverables(a,h?.['traits']),...d&&Object['keys'](d)['length']>0x0?{'guard_resolutions':d}:{},...e?.['review_mode']?{'review_mode':e['review_mode']}:{},...e?.['reward_funding']!==undefined?{'reward_funding':e['reward_funding']}:{}},'template_override':{...a,'fee_params':f},'name_base':a['id']});if(a['allocator']['rows']?.['length'])o['template_allocator_rows']=a['allocator']['rows']['map'](q=>({...q}));o['template']={'id':a['id'],'archetype':a['archetype'],'recommended_role':a['recommended_role'],'fee_params':f},o['template_fee_param_landings']=buildFeeParamLandingTable(a,f);if(c&&Object['keys'](c)['length']>0x0)o['template_fee_overrides']=c;return g&&(o['fee_overrides_prefill']=g,o['next_action']=o['next_action']+'\x20Reward\x20pool\x20prefilled\x20from\x20your\x20request:\x20'+g['value']+'\x20—\x20adjust\x20via\x20fee_overrides.'),o;}export async function handleBenchmarkMigrationOperation(a){const b=strictParse(BenchmarkMigrationSchema,a,'benchmark_migration_operation\x20input'),c=b['industry']?resolveIndustryName(b['industry'])??b['industry']['toLowerCase']():undefined;let d;switch(b['action']){case'template_list':{const {templates:e,errors:f}=listTemplates(),g=c?e['filter'](h=>h['industry']===c):e;d={'action':'template_list','count':g['length'],'templates':g['map'](templateSummary),'load_errors':f};break;}case'template_get':{const h=requireTemplate(b['template_id'],'template_get');d={'action':'template_get','template':{...h}};break;}case'template_generate':{const i=requireTemplate(b['template_id'],'template_generate'),j=scanTemplate(i);assertScanPassed(j,'template_generate');const k=await runGuide(i,b['description'],b['fee_overrides'],b['guard_resolutions'],{'review_mode':b['review_mode'],'reward_funding':b['reward_funding']});d=((()=>{const l=scanSummary(j),m=buildVerdict(l,k);return{'action':'template_generate','template_id':i['id'],'scan':l,'plan':k,'verdict':m,'next_action':planNextAction(k,'template_generate',m)};})());break;}case'template_scan':{const l=requireTemplate(b['template_id'],'template_scan');d={'action':'template_scan','scan':scanTemplate(l)};break;}case'migration_import':{if(!b['description']||!b['description']['trim']())throw new Error('\x27description\x27\x20is\x20required\x20for\x20action=\x27migration_import\x27');const m=planMigration({'url':b['url'],'description':b['description'],'industry':c,'network':b['network']});if(!m)throw new Error('No\x20industry\x20template\x20matched\x20the\x20description.\x20Refine\x20the\x20description\x20or\x20pass\x20an\x20explicit\x20\x27industry\x27\x20hint.');d={'action':'migration_import','log':m,'next_action':'MigrationLog\x20ready.\x20Next:\x20call\x20action=\x27migration_review\x27\x20with\x20this\x20log\x20to\x20surface\x20the\x20mapped/unmapped/manual_review\x20items\x20for\x20user\x20confirmation.'};break;}case'migration_review':{if(!b['log'])throw new Error('\x27log\x27\x20is\x20required\x20for\x20action=\x27migration_review\x27');const n=b['log'],o=Array['isArray'](n['mapped'])?n['mapped']:[],p=Array['isArray'](n['unmapped'])?n['unmapped']:[],q=Array['isArray'](n['manual_review'])?n['manual_review']:[],r=n['risk_check']??{},s=n['source']?.['matched_template']??'',t=p['length']===0x0&&q['length']===0x0&&r['passed']===!![];d={'action':'migration_review','log':n,'review_summary':{'mapped_count':o['length'],'unmapped_count':p['length'],'manual_review_count':q['length'],'risk_passed':r['passed']===!![]},'next_action':t?'Review\x20clean.\x20Proceed:\x20call\x20action=\x27migration_apply\x27\x20with\x20template_id=\x27'+s+'\x27\x20to\x20produce\x20the\x20creation\x20plan\x20(network\x20defaults\x20to\x20testnet;\x20mainnet\x20requires\x20explicit\x20user\x20confirmation).':'Surface\x20the\x20'+p['length']+'\x20unmapped\x20and\x20'+q['length']+'\x20manual_review\x20items'+(r['passed']===!![]?'':'\x20plus\x20the\x20risk_check\x20findings')+'\x20to\x20the\x20user\x20for\x20a\x20decision\x20before\x20action=\x27migration_apply\x27\x20(template_id=\x27'+s+'\x27).'};break;}case'migration_apply':{const u=requireTemplate(b['template_id'],'migration_apply'),v=scanTemplate(u);assertScanPassed(v,'migration_apply');const w=b['network']??'testnet',x=await runGuide(u,b['description'],b['fee_overrides'],b['guard_resolutions'],{'review_mode':b['review_mode'],'reward_funding':b['reward_funding']});d=((()=>{const y=scanSummary(v),z=buildVerdict(y,x);return{'action':'migration_apply','template_id':u['id'],'network':w,'scan':y,'plan':x,'verdict':z,'next_action':planNextAction(x,'migration_apply',z)};})());break;}default:throw new Error('Unknown\x20benchmark_migration_operation\x20action:\x20'+String(b['action']));}return{'content':[{'type':'text','text':JSON['stringify']({'result':d})}],'structuredContent':{'result':d}};}
|