@wowok/agent-mcp 2.4.1 → 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.d.ts +2 -2
- package/dist/index.js +29 -1621
- 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-ledger.js +14 -0
- package/dist/knowledge/guard-lint.d.ts +1 -0
- package/dist/knowledge/guard-lint.js +83 -3
- package/dist/knowledge/guard-migration.d.ts +48 -0
- package/dist/knowledge/guard-migration.js +228 -0
- package/dist/knowledge/guard-puzzle.js +3 -2
- package/dist/knowledge/guard-risk.d.ts +3 -1
- package/dist/knowledge/guard-risk.js +832 -64
- package/dist/knowledge/guard-templates.d.ts +1 -0
- package/dist/knowledge/guard-templates.js +278 -2
- 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/graph.d.ts +1 -0
- package/dist/project/graph.js +27 -1
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +39 -2
- package/dist/project/namespace.d.ts +11 -1
- package/dist/project/namespace.js +27 -2
- package/dist/project/query.d.ts +2 -0
- package/dist/project/query.js +56 -15
- 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/rules.d.ts +12 -0
- package/dist/rules.js +9 -0
- package/dist/schema/call/allocation.d.ts +44 -44
- package/dist/schema/call/arbitration.d.ts +141 -141
- package/dist/schema/call/base.d.ts +386 -386
- package/dist/schema/call/base.js +6 -6
- 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 +96 -96
- 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/semantic.js +1 -1
- package/dist/schema/call/service.d.ts +238 -238
- 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 +1102 -1118
- 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 +818 -818
- package/dist/schema/query/index.js +15 -9
- 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/schema/utils/guard-query-utils.d.ts +7 -0
- package/dist/schema/utils/guard-query-utils.js +14 -1
- package/dist/schemas/account_operation.output.json +718 -0
- package/dist/schemas/bridge_operation.output.json +1 -1
- 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/messenger_operation.output.json +1 -1
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.output.json +5 -4
- package/dist/schemas/onchain_operations.schema.json +1813 -333
- package/dist/schemas/onchain_operations_allocation.schema.json +9 -11
- 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 +4 -6
- 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 +4 -6
- package/dist/schemas/onchain_operations_treasury.schema.json +2 -1
- package/dist/schemas/onchain_table_data.output.json +6 -12
- 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/bridge.d.ts +1 -0
- package/dist/tools/handlers/bridge.js +1 -0
- package/dist/tools/handlers/config.d.ts +2 -0
- package/dist/tools/handlers/config.js +74 -0
- package/dist/tools/handlers/file-export.d.ts +3 -0
- package/dist/tools/handlers/file-export.js +90 -0
- package/dist/tools/handlers/local.d.ts +3 -0
- package/dist/tools/handlers/local.js +38 -0
- package/dist/tools/handlers/messenger.d.ts +16 -0
- package/dist/tools/handlers/messenger.js +188 -0
- package/dist/tools/handlers/onchain.d.ts +2 -0
- package/dist/tools/handlers/onchain.js +248 -0
- package/dist/tools/handlers/project.d.ts +2 -0
- package/dist/tools/handlers/project.js +293 -0
- package/dist/tools/handlers/query.d.ts +5 -0
- package/dist/tools/handlers/query.js +256 -0
- package/dist/tools/handlers/schema-query.d.ts +2 -0
- package/dist/tools/handlers/schema-query.js +93 -0
- package/dist/tools/handlers/trust.d.ts +2 -0
- package/dist/tools/handlers/trust.js +194 -0
- package/dist/tools/handlers/wip.d.ts +2 -0
- package/dist/tools/handlers/wip.js +44 -0
- package/dist/tools/index.d.ts +13 -0
- package/dist/tools/index.js +526 -0
- package/dist/tools/rules-hook.d.ts +2 -0
- package/dist/tools/rules-hook.js +23 -0
- package/dist/tools/shared.d.ts +20 -0
- package/dist/tools/shared.js +130 -0
- package/dist/tools/types.d.ts +35 -0
- package/dist/tools/types.js +1 -0
- package/dist/tools/wrap.d.ts +14 -0
- package/dist/tools/wrap.js +267 -0
- package/package.json +20 -6
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import { strictParse, WatchQueryOperationsSchema, OnchainTableDataSchema, OnchainEventsInputSchema, ProtocolInfoQuerySchema, } from "../../schema/index.js";
|
|
2
|
+
import { query_local_mark_list, query_account_list, query_local_info_list, query_local_token_list, query_account, GetLocalNamesByAddresses, query_personal, query_objects, query_table, query_tableItem, queryTableItem_RepositoryData, queryTableItem_PermissionPerm, queryTableItem_RewardRecord, queryTableItem_DemandPresenter, queryTableItem_TreasuryHistory, queryTableItem_MachineNode, queryTableItem_ProgressHistory, queryTableItem_AddressMark, queryTableItem_EntityRegistrar, queryTableItem_EntityLinker, query_received, queryProtocolInfo, query_events, generateNodeComments, } from "@wowok/wowok";
|
|
3
|
+
import { buildDataSemantic, } from "../../schema/call/semantic.js";
|
|
4
|
+
import { normalizeAccountOrMark } from "./messenger.js";
|
|
5
|
+
export async function handleWatchQueryOperations(args) {
|
|
6
|
+
const validated = strictParse(WatchQueryOperationsSchema, args, "watch_and_query input");
|
|
7
|
+
let result;
|
|
8
|
+
switch (validated.query_type) {
|
|
9
|
+
case "local_mark_list": {
|
|
10
|
+
const queryResult = await query_local_mark_list(validated.filter || {});
|
|
11
|
+
result = { query_type: "local_mark_list", result: queryResult };
|
|
12
|
+
break;
|
|
13
|
+
}
|
|
14
|
+
case "account_list": {
|
|
15
|
+
const queryResult = await query_account_list(validated.filter);
|
|
16
|
+
result = { query_type: "account_list", result: queryResult };
|
|
17
|
+
break;
|
|
18
|
+
}
|
|
19
|
+
case "local_info_list": {
|
|
20
|
+
const queryResult = await query_local_info_list(validated.filter);
|
|
21
|
+
result = { query_type: "local_info_list", result: queryResult };
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
case "token_list": {
|
|
25
|
+
const queryResult = await query_local_token_list(validated.filter || {});
|
|
26
|
+
result = { query_type: "token_list", result: queryResult };
|
|
27
|
+
break;
|
|
28
|
+
}
|
|
29
|
+
case "account_balance": {
|
|
30
|
+
const queryResult = await query_account({
|
|
31
|
+
name_or_address: validated.name_or_address,
|
|
32
|
+
token_type: validated.token_type,
|
|
33
|
+
balance: validated.balance,
|
|
34
|
+
coin: validated.coin,
|
|
35
|
+
network: validated.network,
|
|
36
|
+
});
|
|
37
|
+
result = { query_type: "account_balance", result: queryResult };
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case "local_names": {
|
|
41
|
+
const queryResult = await GetLocalNamesByAddresses(validated.addresses);
|
|
42
|
+
result = { query_type: "local_names", result: queryResult };
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case "onchain_personal_profile": {
|
|
46
|
+
const queryResult = await query_personal({
|
|
47
|
+
account: validated.account,
|
|
48
|
+
no_cache: validated.no_cache,
|
|
49
|
+
network: validated.network,
|
|
50
|
+
});
|
|
51
|
+
result = { query_type: "onchain_personal_profile", result: queryResult };
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
case "onchain_objects": {
|
|
55
|
+
const queryResult = await query_objects({
|
|
56
|
+
objects: validated.objects,
|
|
57
|
+
no_cache: validated.no_cache,
|
|
58
|
+
network: validated.network,
|
|
59
|
+
});
|
|
60
|
+
if (queryResult && queryResult.objects && Array.isArray(queryResult.objects)) {
|
|
61
|
+
queryResult.objects = queryResult.objects.map((obj) => {
|
|
62
|
+
if (obj && obj.data && obj.data.type === "Guard" && obj.data.root) {
|
|
63
|
+
try {
|
|
64
|
+
const nodeComments = generateNodeComments(obj.data.root);
|
|
65
|
+
return {
|
|
66
|
+
...obj,
|
|
67
|
+
_guard_node_comments: nodeComments,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
return obj;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return obj;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
result = { query_type: "onchain_objects", result: queryResult };
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
case "onchain_received": {
|
|
81
|
+
const queryResult = await query_received({
|
|
82
|
+
name_or_address: normalizeAccountOrMark(validated.name_or_address),
|
|
83
|
+
type: validated.type,
|
|
84
|
+
cursor: validated.cursor,
|
|
85
|
+
limit: validated.limit,
|
|
86
|
+
no_cache: validated.no_cache,
|
|
87
|
+
network: validated.network,
|
|
88
|
+
});
|
|
89
|
+
result = { query_type: "onchain_received", result: queryResult };
|
|
90
|
+
break;
|
|
91
|
+
}
|
|
92
|
+
default:
|
|
93
|
+
throw new Error(`Unknown query type. Valid query_types are: "local_mark_list", "account_list", "local_info_list", "token_list", "account_balance", "local_names", "onchain_personal_profile", "onchain_objects", "onchain_received". For table queries, use the "onchain_table_data" tool.`);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
content: [{ type: "text", text: JSON.stringify({ result }) }],
|
|
97
|
+
structuredContent: {
|
|
98
|
+
result,
|
|
99
|
+
semantic: buildDataSemantic(result, {
|
|
100
|
+
operation_type: "query_toolkit",
|
|
101
|
+
data: validated,
|
|
102
|
+
}),
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export async function handleOnchainTableData(args) {
|
|
107
|
+
const validated = strictParse(OnchainTableDataSchema, args, "onchain_table_data input");
|
|
108
|
+
let result;
|
|
109
|
+
switch (validated.query_type) {
|
|
110
|
+
case "onchain_table": {
|
|
111
|
+
const queryResult = await query_table({
|
|
112
|
+
parent: validated.parent,
|
|
113
|
+
cursor: validated.cursor,
|
|
114
|
+
limit: validated.limit,
|
|
115
|
+
no_cache: validated.no_cache,
|
|
116
|
+
network: validated.network,
|
|
117
|
+
});
|
|
118
|
+
result = { query_type: "onchain_table", result: queryResult };
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
case "onchain_table_item_repository_data": {
|
|
122
|
+
const queryResult = await queryTableItem_RepositoryData({
|
|
123
|
+
parent: validated.parent, name: validated.name, entity: validated.entity,
|
|
124
|
+
no_cache: validated.no_cache, network: validated.network,
|
|
125
|
+
});
|
|
126
|
+
result = { query_type: "onchain_table_item_repository_data", result: queryResult };
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
case "onchain_table_item_permission_perm": {
|
|
130
|
+
const queryResult = await queryTableItem_PermissionPerm({
|
|
131
|
+
parent: validated.parent, address: validated.address,
|
|
132
|
+
no_cache: validated.no_cache, network: validated.network,
|
|
133
|
+
});
|
|
134
|
+
result = { query_type: "onchain_table_item_permission_perm", result: queryResult };
|
|
135
|
+
break;
|
|
136
|
+
}
|
|
137
|
+
case "onchain_table_item_reward_record": {
|
|
138
|
+
const queryResult = await queryTableItem_RewardRecord({
|
|
139
|
+
parent: validated.parent, address: validated.address,
|
|
140
|
+
no_cache: validated.no_cache, network: validated.network,
|
|
141
|
+
});
|
|
142
|
+
result = { query_type: "onchain_table_item_reward_record", result: queryResult };
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
145
|
+
case "onchain_table_item_demand_presenter": {
|
|
146
|
+
const queryResult = await queryTableItem_DemandPresenter({
|
|
147
|
+
parent: validated.parent, address: validated.address,
|
|
148
|
+
no_cache: validated.no_cache, network: validated.network,
|
|
149
|
+
});
|
|
150
|
+
result = { query_type: "onchain_table_item_demand_presenter", result: queryResult };
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
case "onchain_table_item_treasury_history": {
|
|
154
|
+
const queryResult = await queryTableItem_TreasuryHistory({
|
|
155
|
+
parent: validated.parent, address: validated.address,
|
|
156
|
+
no_cache: validated.no_cache, network: validated.network,
|
|
157
|
+
});
|
|
158
|
+
result = { query_type: "onchain_table_item_treasury_history", result: queryResult };
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
case "onchain_table_item_machine_node": {
|
|
162
|
+
const queryResult = await queryTableItem_MachineNode({
|
|
163
|
+
parent: validated.parent, key: validated.key,
|
|
164
|
+
no_cache: validated.no_cache, network: validated.network,
|
|
165
|
+
});
|
|
166
|
+
result = { query_type: "onchain_table_item_machine_node", result: queryResult };
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
case "onchain_table_item_progress_history": {
|
|
170
|
+
const queryResult = await queryTableItem_ProgressHistory({
|
|
171
|
+
parent: validated.parent, u64: validated.u64,
|
|
172
|
+
no_cache: validated.no_cache, network: validated.network,
|
|
173
|
+
});
|
|
174
|
+
result = { query_type: "onchain_table_item_progress_history", result: queryResult };
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
case "onchain_table_item_address_mark": {
|
|
178
|
+
const queryResult = await queryTableItem_AddressMark({
|
|
179
|
+
parent: validated.parent, address: validated.address,
|
|
180
|
+
no_cache: validated.no_cache, network: validated.network,
|
|
181
|
+
});
|
|
182
|
+
result = { query_type: "onchain_table_item_address_mark", result: queryResult };
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
case "onchain_table_item_entity_registrar": {
|
|
186
|
+
const queryResult = await queryTableItem_EntityRegistrar({
|
|
187
|
+
address: validated.address,
|
|
188
|
+
no_cache: validated.no_cache, network: validated.network,
|
|
189
|
+
});
|
|
190
|
+
result = { query_type: "onchain_table_item_entity_registrar", result: queryResult };
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
case "onchain_table_item_entity_linker": {
|
|
194
|
+
const queryResult = await queryTableItem_EntityLinker({
|
|
195
|
+
address: validated.address,
|
|
196
|
+
no_cache: validated.no_cache, network: validated.network,
|
|
197
|
+
});
|
|
198
|
+
result = { query_type: "onchain_table_item_entity_linker", result: queryResult };
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
case "onchain_table_item_generic": {
|
|
202
|
+
const queryResult = await query_tableItem({
|
|
203
|
+
parent: validated.parent,
|
|
204
|
+
key: { type: validated.key_type, value: validated.key_value },
|
|
205
|
+
no_cache: validated.no_cache,
|
|
206
|
+
network: validated.network,
|
|
207
|
+
});
|
|
208
|
+
result = { query_type: "onchain_table_item_generic", result: queryResult };
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
default:
|
|
212
|
+
throw new Error(`Unknown table query type. Valid query_types are: "onchain_table", "onchain_table_item_repository_data", "onchain_table_item_permission_perm", "onchain_table_item_reward_record", "onchain_table_item_demand_presenter", "onchain_table_item_treasury_history", "onchain_table_item_machine_node", "onchain_table_item_progress_history", "onchain_table_item_address_mark", "onchain_table_item_entity_registrar", "onchain_table_item_entity_linker", "onchain_table_item_generic"`);
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
content: [{ type: "text", text: JSON.stringify({ result }) }],
|
|
216
|
+
structuredContent: {
|
|
217
|
+
result,
|
|
218
|
+
semantic: buildDataSemantic(result, {
|
|
219
|
+
operation_type: "onchain_table_data",
|
|
220
|
+
data: validated,
|
|
221
|
+
}),
|
|
222
|
+
},
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
export async function handleOnchainEvents(args) {
|
|
226
|
+
const validated = strictParse(OnchainEventsInputSchema, args, "onchain_events input");
|
|
227
|
+
const queryResult = await query_events({
|
|
228
|
+
type: validated.type,
|
|
229
|
+
cursor: validated.cursor ? {
|
|
230
|
+
eventSeq: String(validated.cursor.eventSeq),
|
|
231
|
+
txDigest: validated.cursor.txDigest,
|
|
232
|
+
} : null,
|
|
233
|
+
limit: validated.limit ?? null,
|
|
234
|
+
order: validated.order ?? null,
|
|
235
|
+
no_cache: validated.no_cache,
|
|
236
|
+
network: validated.network,
|
|
237
|
+
});
|
|
238
|
+
return {
|
|
239
|
+
content: [{ type: "text", text: JSON.stringify({ result: queryResult }) }],
|
|
240
|
+
structuredContent: {
|
|
241
|
+
result: queryResult,
|
|
242
|
+
semantic: buildDataSemantic(queryResult, {
|
|
243
|
+
operation_type: "onchain_events",
|
|
244
|
+
data: validated,
|
|
245
|
+
}),
|
|
246
|
+
},
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
export async function handleWowokInfo(args) {
|
|
250
|
+
const validated = strictParse(ProtocolInfoQuerySchema, args, "wowok_buildin_info input");
|
|
251
|
+
const queryResult = await queryProtocolInfo(validated);
|
|
252
|
+
return {
|
|
253
|
+
content: [{ type: "text", text: JSON.stringify({ result: queryResult }) }],
|
|
254
|
+
structuredContent: { result: queryResult },
|
|
255
|
+
};
|
|
256
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { processSchemaQuery, } from "../../schema-query/index.js";
|
|
2
|
+
import { strictParse } from "../../schema/index.js";
|
|
3
|
+
import { SchemaQueryInputSchema } from "../../schema/schema-query/index.js";
|
|
4
|
+
export async function handleSchemaQuery(args) {
|
|
5
|
+
const validated = strictParse(SchemaQueryInputSchema, args, "schema_query input");
|
|
6
|
+
const request = {
|
|
7
|
+
action: validated.action,
|
|
8
|
+
name: validated.name,
|
|
9
|
+
query: validated.query,
|
|
10
|
+
};
|
|
11
|
+
const response = processSchemaQuery(request);
|
|
12
|
+
let textContent = response.message;
|
|
13
|
+
const data = response.data;
|
|
14
|
+
if (response.success && data) {
|
|
15
|
+
switch (request.action) {
|
|
16
|
+
case "list":
|
|
17
|
+
if (Array.isArray(data) && data.length > 0) {
|
|
18
|
+
textContent += "\n\nAll available schemas:\n";
|
|
19
|
+
for (const item of data) {
|
|
20
|
+
textContent += `\n • ${item.name ?? ""}`;
|
|
21
|
+
if (item.title) {
|
|
22
|
+
textContent += ` - ${item.title}`;
|
|
23
|
+
}
|
|
24
|
+
if (item.description) {
|
|
25
|
+
textContent += `\n ${item.description.slice(0, 100)}...`;
|
|
26
|
+
}
|
|
27
|
+
textContent += "\n";
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
case "list_operations":
|
|
32
|
+
if (Array.isArray(data) && data.length > 0) {
|
|
33
|
+
textContent += "\n\nOn-chain operation schemas:\n";
|
|
34
|
+
for (const item of data) {
|
|
35
|
+
textContent += `\n • ${item.name ?? ""}`;
|
|
36
|
+
if (item.title) {
|
|
37
|
+
textContent += ` - ${item.title}`;
|
|
38
|
+
}
|
|
39
|
+
if (item.description) {
|
|
40
|
+
textContent += `\n ${item.description.slice(0, 100)}...`;
|
|
41
|
+
}
|
|
42
|
+
textContent += "\n";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
break;
|
|
46
|
+
case "get":
|
|
47
|
+
textContent += "\n\n## JSON Schema\n\n";
|
|
48
|
+
textContent += "```json\n";
|
|
49
|
+
textContent += JSON.stringify(data, null, 2);
|
|
50
|
+
textContent += "\n```\n";
|
|
51
|
+
break;
|
|
52
|
+
case "get_output":
|
|
53
|
+
textContent += "\n\n## Output JSON Schema\n\n";
|
|
54
|
+
textContent += "```json\n";
|
|
55
|
+
textContent += JSON.stringify(data, null, 2);
|
|
56
|
+
textContent += "\n```\n";
|
|
57
|
+
break;
|
|
58
|
+
case "search":
|
|
59
|
+
if (Array.isArray(data) && data.length > 0) {
|
|
60
|
+
textContent += `\n\nFound ${data.length} schemas matching '${request.query ?? ""}':\n`;
|
|
61
|
+
for (const item of data) {
|
|
62
|
+
textContent += `\n • ${item.name ?? ""}`;
|
|
63
|
+
if (item.title) {
|
|
64
|
+
textContent += ` - ${item.title}`;
|
|
65
|
+
}
|
|
66
|
+
if (item.description) {
|
|
67
|
+
textContent += `\n ${item.description.slice(0, 100)}...`;
|
|
68
|
+
}
|
|
69
|
+
textContent += "\n";
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
textContent += "\n\nNo schemas found. Try 'list' to browse all available schemas, or use a broader search term.";
|
|
74
|
+
}
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
throw new Error(`Unknown schema_query action: ${String(request.action)}`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (response.suggestions && response.suggestions.length > 0) {
|
|
81
|
+
textContent += "\n\n💡 Suggestions:\n";
|
|
82
|
+
for (const suggestion of response.suggestions) {
|
|
83
|
+
textContent += ` • ${suggestion}\n`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
content: [{
|
|
88
|
+
type: "text",
|
|
89
|
+
text: textContent,
|
|
90
|
+
}],
|
|
91
|
+
structuredContent: response,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { strictParse, TrustScoreInputSchema, } from "../../schema/index.js";
|
|
2
|
+
import { query_objects, } from "@wowok/wowok";
|
|
3
|
+
import { computeServiceTrustScore, } from "../../knowledge/index.js";
|
|
4
|
+
import { assembleInfoPuzzle, assessRisk, } from "../../customer/index.js";
|
|
5
|
+
function extractTrustMetrics(serviceObj) {
|
|
6
|
+
const data = serviceObj?.data ?? serviceObj ?? {};
|
|
7
|
+
const sales = Array.isArray(data.sales) ? data.sales : [];
|
|
8
|
+
const activeSales = sales.filter((s) => s && !s.suspension);
|
|
9
|
+
void activeSales;
|
|
10
|
+
const compensationFund = data.compensation_fund;
|
|
11
|
+
const compBalance = (() => {
|
|
12
|
+
if (compensationFund === null || compensationFund === undefined)
|
|
13
|
+
return undefined;
|
|
14
|
+
if (typeof compensationFund === "bigint")
|
|
15
|
+
return compensationFund;
|
|
16
|
+
if (typeof compensationFund === "number")
|
|
17
|
+
return BigInt(compensationFund);
|
|
18
|
+
if (typeof compensationFund === "string") {
|
|
19
|
+
try {
|
|
20
|
+
return BigInt(compensationFund);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (typeof compensationFund === "object") {
|
|
27
|
+
const bal = compensationFund.balance;
|
|
28
|
+
if (bal === null || bal === undefined)
|
|
29
|
+
return undefined;
|
|
30
|
+
try {
|
|
31
|
+
return BigInt(bal);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
38
|
+
})();
|
|
39
|
+
return {
|
|
40
|
+
arbitrationCases: Array.isArray(data.arbitrations) ? data.arbitrations.length : undefined,
|
|
41
|
+
compensationFundBalance: compBalance,
|
|
42
|
+
hasMachineBound: typeof data.machine === "string" && data.machine.length > 0,
|
|
43
|
+
hasBuyGuard: typeof data.buy_guard === "string" && data.buy_guard.length > 0,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function buildPuzzleRawData(serviceObj, orderAmount, trustScore, serviceOwner) {
|
|
47
|
+
const data = serviceObj?.data ?? serviceObj ?? {};
|
|
48
|
+
const sales = Array.isArray(data.sales) ? data.sales : [];
|
|
49
|
+
const order_allocators = data.order_allocators
|
|
50
|
+
? Array.isArray(data.order_allocators.allocators)
|
|
51
|
+
? data.order_allocators
|
|
52
|
+
: { allocators: data.order_allocators }
|
|
53
|
+
: undefined;
|
|
54
|
+
const serviceRaw = {
|
|
55
|
+
name: data.name ?? serviceObj?.id,
|
|
56
|
+
bPublished: data.bPublished,
|
|
57
|
+
bPaused: data.bPaused,
|
|
58
|
+
price: sales[0]?.price != null ? String(sales[0].price) : "0",
|
|
59
|
+
priceRaw: sales[0]?.price != null ? BigInt(sales[0].price) : 0n,
|
|
60
|
+
token_type: sales[0]?.price_type ?? (compensation_fund_token(data) ?? "0x2::wow::WOW"),
|
|
61
|
+
sales,
|
|
62
|
+
machine: data.machine ?? undefined,
|
|
63
|
+
buy_guard: data.buy_guard ?? undefined,
|
|
64
|
+
customer_required: data.customer_required,
|
|
65
|
+
arbitrations: data.arbitrations,
|
|
66
|
+
compensation_fund: data.compensation_fund
|
|
67
|
+
? { balance: extractBalance(data.compensation_fund) }
|
|
68
|
+
: undefined,
|
|
69
|
+
compensation_lock_duration: typeof data.setting_lock_duration === "number"
|
|
70
|
+
? data.setting_lock_duration
|
|
71
|
+
: undefined,
|
|
72
|
+
um: data.um ?? undefined,
|
|
73
|
+
order_allocators: order_allocators ? [order_allocators] : undefined,
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
service: serviceRaw,
|
|
77
|
+
order_amount: orderAmount,
|
|
78
|
+
trust_score: trustScore,
|
|
79
|
+
service_owner: serviceOwner,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function compensation_fund_token(data) {
|
|
83
|
+
if (data?.compensation_fund && typeof data.compensation_fund === "object") {
|
|
84
|
+
return data.compensation_fund.token_type;
|
|
85
|
+
}
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
function extractBalance(b) {
|
|
89
|
+
if (b === null || b === undefined)
|
|
90
|
+
return 0n;
|
|
91
|
+
if (typeof b === "bigint")
|
|
92
|
+
return b;
|
|
93
|
+
if (typeof b === "number")
|
|
94
|
+
return BigInt(b);
|
|
95
|
+
if (typeof b === "string") {
|
|
96
|
+
try {
|
|
97
|
+
return BigInt(b);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return 0n;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (typeof b === "object") {
|
|
104
|
+
const bal = b.balance;
|
|
105
|
+
if (bal === null || bal === undefined)
|
|
106
|
+
return 0n;
|
|
107
|
+
try {
|
|
108
|
+
return BigInt(bal);
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return 0n;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return 0n;
|
|
115
|
+
}
|
|
116
|
+
export async function handleTrustScore(args) {
|
|
117
|
+
const validated = strictParse(TrustScoreInputSchema, args, "trust_score input");
|
|
118
|
+
const depth = (validated.depth ?? "evaluate");
|
|
119
|
+
const queryResult = await query_objects({
|
|
120
|
+
objects: [validated.service],
|
|
121
|
+
no_cache: validated.no_cache,
|
|
122
|
+
network: validated.network,
|
|
123
|
+
});
|
|
124
|
+
const objects = queryResult?.objects;
|
|
125
|
+
if (!objects || !Array.isArray(objects) || objects.length === 0) {
|
|
126
|
+
throw new Error(`Service object not found for '${validated.service}'. ` +
|
|
127
|
+
`Verify the ID/name and network, or use query_toolkit with query_type='onchain_objects' to debug.`);
|
|
128
|
+
}
|
|
129
|
+
const serviceObj = objects[0];
|
|
130
|
+
const objType = serviceObj?.data?.object_type ?? serviceObj?.object_type ?? serviceObj?.type;
|
|
131
|
+
if (objType && typeof objType === "string" && !objType.includes("Service")) {
|
|
132
|
+
throw new Error(`Object '${validated.service}' is not a Service (type: ${objType}). ` +
|
|
133
|
+
`trust_score only evaluates Service objects.`);
|
|
134
|
+
}
|
|
135
|
+
const metrics = extractTrustMetrics(serviceObj);
|
|
136
|
+
const trustScore = computeServiceTrustScore(metrics);
|
|
137
|
+
const sales = Array.isArray(serviceObj?.data?.sales) ? serviceObj.data.sales : [];
|
|
138
|
+
const activeSale = sales.find((s) => s && !s.suspension) ?? sales[0];
|
|
139
|
+
const salePriceRaw = activeSale?.price != null ? BigInt(activeSale.price) : 0n;
|
|
140
|
+
const orderAmount = validated.order_amount != null
|
|
141
|
+
? BigInt(validated.order_amount)
|
|
142
|
+
: salePriceRaw;
|
|
143
|
+
let riskScore;
|
|
144
|
+
let infoPuzzle;
|
|
145
|
+
if (depth === "evaluate" || depth === "preorder") {
|
|
146
|
+
const puzzleRaw = buildPuzzleRawData(serviceObj, orderAmount, { score: trustScore.score, level: trustScore.level }, undefined);
|
|
147
|
+
infoPuzzle = assembleInfoPuzzle(validated.service, puzzleRaw, depth);
|
|
148
|
+
riskScore = assessRisk(infoPuzzle);
|
|
149
|
+
}
|
|
150
|
+
const result = {
|
|
151
|
+
service_id: validated.service,
|
|
152
|
+
service_name: serviceObj?.data?.name ?? serviceObj?.name ?? validated.service,
|
|
153
|
+
service_basics: {
|
|
154
|
+
bPublished: serviceObj?.data?.bPublished ?? false,
|
|
155
|
+
bPaused: serviceObj?.data?.bPaused ?? false,
|
|
156
|
+
sales_count: sales.filter((s) => s && !s.suspension).length,
|
|
157
|
+
has_machine: !!serviceObj?.data?.machine,
|
|
158
|
+
has_buy_guard: !!serviceObj?.data?.buy_guard,
|
|
159
|
+
has_um_contact: !!serviceObj?.data?.um,
|
|
160
|
+
arbitrations_count: Array.isArray(serviceObj?.data?.arbitrations)
|
|
161
|
+
? serviceObj.data.arbitrations.length
|
|
162
|
+
: 0,
|
|
163
|
+
},
|
|
164
|
+
trust_score: {
|
|
165
|
+
score: trustScore.score,
|
|
166
|
+
level: trustScore.level,
|
|
167
|
+
summary: trustScore.summary,
|
|
168
|
+
warnings: trustScore.warnings,
|
|
169
|
+
breakdown: trustScore.breakdown,
|
|
170
|
+
},
|
|
171
|
+
order_amount: orderAmount.toString(),
|
|
172
|
+
depth,
|
|
173
|
+
...(riskScore ? {
|
|
174
|
+
risk_score: {
|
|
175
|
+
total: riskScore.total,
|
|
176
|
+
level: riskScore.level,
|
|
177
|
+
red_flags: riskScore.red_flags,
|
|
178
|
+
advice: riskScore.advice,
|
|
179
|
+
dimensions: riskScore.dimensions,
|
|
180
|
+
},
|
|
181
|
+
} : {}),
|
|
182
|
+
...(infoPuzzle ? {
|
|
183
|
+
info_puzzle: {
|
|
184
|
+
completeness: infoPuzzle.completeness,
|
|
185
|
+
gaps: infoPuzzle.gaps,
|
|
186
|
+
assembled_at: infoPuzzle.assembled_at,
|
|
187
|
+
},
|
|
188
|
+
} : {}),
|
|
189
|
+
};
|
|
190
|
+
return {
|
|
191
|
+
content: [{ type: "text", text: JSON.stringify({ result }) }],
|
|
192
|
+
structuredContent: { result },
|
|
193
|
+
};
|
|
194
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { strictParse, WipOperationsSchema, } from "../../schema/index.js";
|
|
2
|
+
import { generate_wip, verify_wip, sign_wip, wip2html, } from "@wowok/wowok";
|
|
3
|
+
export async function handleWipOperations(args) {
|
|
4
|
+
const validated = strictParse(WipOperationsSchema, args, "wip_file input");
|
|
5
|
+
let structuredContent;
|
|
6
|
+
switch (validated.type) {
|
|
7
|
+
case "generate": {
|
|
8
|
+
const result = await generate_wip(validated.options, validated.outputPath);
|
|
9
|
+
structuredContent = { result: { type: "generate", filePath: result } };
|
|
10
|
+
break;
|
|
11
|
+
}
|
|
12
|
+
case "verify": {
|
|
13
|
+
const result = await verify_wip(validated.wipFilePath, validated.hash_equal, validated.requireSignature);
|
|
14
|
+
structuredContent = { result: { type: "verify", ...result } };
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
case "sign": {
|
|
18
|
+
const result = await sign_wip(validated.wipFilePath, validated.account, validated.outputPath);
|
|
19
|
+
structuredContent = { result: { type: "sign", filePath: result } };
|
|
20
|
+
break;
|
|
21
|
+
}
|
|
22
|
+
case "wip2html": {
|
|
23
|
+
const result = await wip2html(validated.wipPath, validated.options);
|
|
24
|
+
const output = { type: "wip2html" };
|
|
25
|
+
if (typeof result === "string") {
|
|
26
|
+
output.html = result;
|
|
27
|
+
}
|
|
28
|
+
else if (Array.isArray(result)) {
|
|
29
|
+
output.files = result;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
output.html = String(result);
|
|
33
|
+
}
|
|
34
|
+
structuredContent = { result: output };
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
default:
|
|
38
|
+
throw new Error("Unknown WIP operation type");
|
|
39
|
+
}
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: "text", text: JSON.stringify(structuredContent) }],
|
|
42
|
+
structuredContent,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { ToolEntry, ToolDispatchResult, DispatchOptions } from "./types.js";
|
|
3
|
+
export declare const TOOL_REGISTRY: ToolEntry[];
|
|
4
|
+
export declare const TOOL_REGISTRY_MAP: Map<string, ToolEntry>;
|
|
5
|
+
export declare function dispatchToolCall(name: string, args: unknown, options?: DispatchOptions): Promise<ToolDispatchResult>;
|
|
6
|
+
export interface ToolListEntry {
|
|
7
|
+
name: string;
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
inputSchema: Record<string, unknown>;
|
|
11
|
+
}
|
|
12
|
+
export declare function listTools(): ToolListEntry[];
|
|
13
|
+
export declare function registerAllTools(server: McpServer): void;
|