@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
|
@@ -17,7 +17,43 @@
|
|
|
17
17
|
"description": "The action that was performed"
|
|
18
18
|
},
|
|
19
19
|
"data": {
|
|
20
|
-
"
|
|
20
|
+
"anyOf": [
|
|
21
|
+
{
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"name": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "Schema/tool identifier (e.g. 'onchain_operations')."
|
|
29
|
+
},
|
|
30
|
+
"title": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "Human-readable title, if known."
|
|
33
|
+
},
|
|
34
|
+
"description": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"description": "Short description, if known."
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"required": [
|
|
40
|
+
"name"
|
|
41
|
+
],
|
|
42
|
+
"additionalProperties": false
|
|
43
|
+
},
|
|
44
|
+
"description": "List of schema summaries (list/search/list_operations)."
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "object",
|
|
48
|
+
"additionalProperties": {},
|
|
49
|
+
"description": "JSON Schema object (get/get_output)."
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "null",
|
|
53
|
+
"description": "No data — lookup failed or returned nothing."
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
"description": "Response data — array of schema summaries for list-like actions, JSON Schema object for get/get_output, null on failure."
|
|
21
57
|
},
|
|
22
58
|
"message": {
|
|
23
59
|
"type": "string",
|
|
@@ -34,6 +70,7 @@
|
|
|
34
70
|
"required": [
|
|
35
71
|
"success",
|
|
36
72
|
"action",
|
|
73
|
+
"data",
|
|
37
74
|
"message"
|
|
38
75
|
],
|
|
39
76
|
"additionalProperties": false
|
|
@@ -15,5 +15,5 @@ export declare function isTelemetryEnabled(): boolean;
|
|
|
15
15
|
export declare function captureTelemetry(toolName: string, structuredContent: CallOutput | undefined, durationMs: number, operationTypeHint?: string): Promise<void>;
|
|
16
16
|
export declare function captureTelemetryError(toolName: string, error: any, durationMs: number, operationTypeHint?: string): Promise<void>;
|
|
17
17
|
export declare function withTelemetry<TArgs, TOutput extends {
|
|
18
|
-
structuredContent?:
|
|
18
|
+
structuredContent?: unknown;
|
|
19
19
|
}>(toolName: string, handler: (args: TArgs) => Promise<TOutput>): (args: TArgs) => Promise<TOutput>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { handleBridgeOperations } from "../../schema/call/bridge-handler.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { handleBridgeOperations } from "../../schema/call/bridge-handler.js";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { listServices, getServiceInfo, toggle as toggleService, setEnabled as setServiceEnabled, reset as resetService, } from "../../config/index.js";
|
|
2
|
+
import { strictParse } from "../../schema/index.js";
|
|
3
|
+
import { ConfigOperationInputSchema } from "../../schema/config/index.js";
|
|
4
|
+
export async function handleConfigOperation(args) {
|
|
5
|
+
const validated = strictParse(ConfigOperationInputSchema, args, "config_operation input");
|
|
6
|
+
const { action, service: serviceRaw } = validated;
|
|
7
|
+
let result;
|
|
8
|
+
switch (action) {
|
|
9
|
+
case "list":
|
|
10
|
+
result = { action: "list", services: listServices() };
|
|
11
|
+
break;
|
|
12
|
+
case "toggle": {
|
|
13
|
+
if (!serviceRaw)
|
|
14
|
+
throw new Error("'service' param is required for toggle");
|
|
15
|
+
const service = serviceRaw;
|
|
16
|
+
const existing = getServiceInfo(service);
|
|
17
|
+
if (!existing) {
|
|
18
|
+
throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
|
|
19
|
+
}
|
|
20
|
+
const newState = toggleService(service);
|
|
21
|
+
result = { action: "toggle", service, enabled: newState, reminder: existing.reminder };
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
case "enable": {
|
|
25
|
+
if (!serviceRaw)
|
|
26
|
+
throw new Error("'service' param is required for enable");
|
|
27
|
+
const service = serviceRaw;
|
|
28
|
+
const existing = getServiceInfo(service);
|
|
29
|
+
if (!existing)
|
|
30
|
+
throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
|
|
31
|
+
setServiceEnabled(service, true);
|
|
32
|
+
result = { action: "enable", service, enabled: true, reminder: existing.reminder };
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
case "disable": {
|
|
36
|
+
if (!serviceRaw)
|
|
37
|
+
throw new Error("'service' param is required for disable");
|
|
38
|
+
const service = serviceRaw;
|
|
39
|
+
const existing = getServiceInfo(service);
|
|
40
|
+
if (!existing)
|
|
41
|
+
throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
|
|
42
|
+
setServiceEnabled(service, false);
|
|
43
|
+
result = { action: "disable", service, enabled: false, reminder: existing.reminder };
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case "reset": {
|
|
47
|
+
if (!serviceRaw)
|
|
48
|
+
throw new Error("'service' param is required for reset");
|
|
49
|
+
const service = serviceRaw;
|
|
50
|
+
const existing = getServiceInfo(service);
|
|
51
|
+
if (!existing)
|
|
52
|
+
throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
|
|
53
|
+
resetService(service);
|
|
54
|
+
result = { action: "reset", service, enabled: getServiceInfo(service)?.enabled, reminder: existing.reminder, reset: true };
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case "info": {
|
|
58
|
+
if (!serviceRaw)
|
|
59
|
+
throw new Error("'service' param is required for info");
|
|
60
|
+
const service = serviceRaw;
|
|
61
|
+
const info = getServiceInfo(service);
|
|
62
|
+
if (!info)
|
|
63
|
+
throw new Error(`Unknown service: ${service}. Use action='list' to see all valid services.`);
|
|
64
|
+
result = { action: "info", ...info };
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
default:
|
|
68
|
+
throw new Error(`Unknown config_operation action: ${String(action)}`);
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
content: [{ type: "text", text: JSON.stringify({ result }) }],
|
|
72
|
+
structuredContent: { result },
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
import { strictParse, getEnvConfig, Guard2File_InputSchema, MachineNode2File_InputSchema, } from "../../schema/index.js";
|
|
3
|
+
import { guard2file, machineNode2file, } from "@wowok/wowok";
|
|
4
|
+
export async function handleGuard2File(args) {
|
|
5
|
+
const validated = strictParse(Guard2File_InputSchema, args, "guard2file input");
|
|
6
|
+
const env = getEnvConfig(validated.env);
|
|
7
|
+
try {
|
|
8
|
+
await guard2file(validated.guard, validated.file_path, validated.format || "json", env.network);
|
|
9
|
+
const result = {
|
|
10
|
+
result: {
|
|
11
|
+
status: "success",
|
|
12
|
+
data: {
|
|
13
|
+
file_path: resolve(validated.file_path),
|
|
14
|
+
format: validated.format || "json",
|
|
15
|
+
guard_object: validated.guard,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
21
|
+
structuredContent: result,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
const result = {
|
|
26
|
+
result: {
|
|
27
|
+
status: "error",
|
|
28
|
+
error: error.message,
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
33
|
+
structuredContent: result,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export async function handleMachineNode2File(args) {
|
|
38
|
+
const validated = strictParse(MachineNode2File_InputSchema, args, "machineNode2file input");
|
|
39
|
+
const env = getEnvConfig(validated.env);
|
|
40
|
+
try {
|
|
41
|
+
await machineNode2file(validated.machine, validated.file_path, validated.format || "json", env.network);
|
|
42
|
+
let node_count = undefined;
|
|
43
|
+
try {
|
|
44
|
+
const filePath = resolve(validated.file_path);
|
|
45
|
+
const fileContent = await import('fs/promises').then(fs => fs.readFile(filePath, 'utf-8'));
|
|
46
|
+
if ((validated.format || "json") === "json") {
|
|
47
|
+
const parsed = JSON.parse(fileContent);
|
|
48
|
+
if (Array.isArray(parsed)) {
|
|
49
|
+
node_count = parsed.length;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const nodeMatches = fileContent.match(/^##\s+Node:/gm);
|
|
54
|
+
node_count = nodeMatches ? nodeMatches.length : 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
node_count = undefined;
|
|
59
|
+
}
|
|
60
|
+
const result = {
|
|
61
|
+
result: {
|
|
62
|
+
status: "success",
|
|
63
|
+
data: {
|
|
64
|
+
file_path: resolve(validated.file_path),
|
|
65
|
+
format: validated.format || "json",
|
|
66
|
+
machine_object: validated.machine,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
if (node_count !== undefined) {
|
|
71
|
+
result.result.data.node_count = node_count;
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
75
|
+
structuredContent: result,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const result = {
|
|
80
|
+
result: {
|
|
81
|
+
status: "error",
|
|
82
|
+
error: error.message,
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
87
|
+
structuredContent: result,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const handleAccountOperation: (args: unknown) => Promise<import("../types.js").ToolDispatchResult>;
|
|
2
|
+
export declare const handleMarkOperation: (args: unknown) => Promise<import("../types.js").ToolDispatchResult>;
|
|
3
|
+
export declare const handleInfoOperation: (args: unknown) => Promise<import("../types.js").ToolDispatchResult>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { wrapLocalHandler } from "../shared.js";
|
|
2
|
+
import { AccountOperationSchema, LocalMarkOperationSchema, LocalInfoOperationSchema, } from "../../schema/index.js";
|
|
3
|
+
import { account_operation, local_mark_operation, local_info_operation, } from "@wowok/wowok";
|
|
4
|
+
function deriveOpType(prefix, validated) {
|
|
5
|
+
for (const key of Object.keys(validated)) {
|
|
6
|
+
if (validated[key] !== undefined) {
|
|
7
|
+
return `${prefix}_${String(key)}`;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
return `${prefix}_unknown`;
|
|
11
|
+
}
|
|
12
|
+
export const handleAccountOperation = wrapLocalHandler({
|
|
13
|
+
schema: AccountOperationSchema,
|
|
14
|
+
operationFn: account_operation,
|
|
15
|
+
parseLabel: "account_operation input",
|
|
16
|
+
buildContext: (validated) => ({
|
|
17
|
+
operation_type: deriveOpType("account", validated),
|
|
18
|
+
data: validated,
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
export const handleMarkOperation = wrapLocalHandler({
|
|
22
|
+
schema: LocalMarkOperationSchema,
|
|
23
|
+
operationFn: local_mark_operation,
|
|
24
|
+
parseLabel: "local_mark_operation input",
|
|
25
|
+
buildContext: (validated) => ({
|
|
26
|
+
operation_type: deriveOpType("mark", validated),
|
|
27
|
+
data: validated,
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
export const handleInfoOperation = wrapLocalHandler({
|
|
31
|
+
schema: LocalInfoOperationSchema,
|
|
32
|
+
operationFn: local_info_operation,
|
|
33
|
+
parseLabel: "local_info_operation input",
|
|
34
|
+
buildContext: (validated) => ({
|
|
35
|
+
operation_type: deriveOpType("local_info", validated),
|
|
36
|
+
data: validated,
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ToolDispatchResult } from "../types.js";
|
|
2
|
+
export declare function normalizeAccountOrMark(input: string | {
|
|
3
|
+
name_or_address?: string;
|
|
4
|
+
local_mark_first?: boolean;
|
|
5
|
+
}): {
|
|
6
|
+
name_or_address?: string;
|
|
7
|
+
local_mark_first?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function normalizeManyAccountOrMark(input: string[] | {
|
|
10
|
+
entities: any[];
|
|
11
|
+
check_all_founded?: boolean;
|
|
12
|
+
}): {
|
|
13
|
+
entities: any[];
|
|
14
|
+
check_all_founded?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function handleMessengerOperation(args: unknown): Promise<ToolDispatchResult>;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { strictParse, MessengerOperationInputSchema, } from "../../schema/index.js";
|
|
2
|
+
import { watch_conversations, send_message, send_file, watch_messages, extract_zip_messages, pull_messages, generate_wts, verify_wts, sign_wts, wts2html, proof_message, mark_messages_as_viewed, mark_conversation_as_viewed, blacklist, friendslist, guardlist, settings, } from "@wowok/wowok";
|
|
3
|
+
import { classifyError, buildDataSemantic, } from "../../schema/call/semantic.js";
|
|
4
|
+
export function normalizeAccountOrMark(input) {
|
|
5
|
+
if (typeof input === 'string') {
|
|
6
|
+
return { name_or_address: input, local_mark_first: true };
|
|
7
|
+
}
|
|
8
|
+
return input;
|
|
9
|
+
}
|
|
10
|
+
export function normalizeManyAccountOrMark(input) {
|
|
11
|
+
if (Array.isArray(input)) {
|
|
12
|
+
return {
|
|
13
|
+
entities: input.map(item => typeof item === 'string' ? { name_or_address: item, local_mark_first: true } : item),
|
|
14
|
+
check_all_founded: true,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return input;
|
|
18
|
+
}
|
|
19
|
+
export async function handleMessengerOperation(args) {
|
|
20
|
+
let validated;
|
|
21
|
+
try {
|
|
22
|
+
validated = strictParse(MessengerOperationInputSchema, args, "messenger_operation input");
|
|
23
|
+
const opLiteral = validated.operation;
|
|
24
|
+
let result;
|
|
25
|
+
switch (validated.operation) {
|
|
26
|
+
case "watch_conversations": {
|
|
27
|
+
const conversations = await watch_conversations(validated.filter);
|
|
28
|
+
result = { operation: "watch_conversations", result: conversations };
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case "send_message": {
|
|
32
|
+
const sendResult = await send_message(validated.from, normalizeAccountOrMark(validated.to), validated.content, validated.options);
|
|
33
|
+
const filteredResult = {
|
|
34
|
+
...sendResult,
|
|
35
|
+
merkleData: sendResult.merkleData ? {
|
|
36
|
+
leafIndex: sendResult.merkleData.leafIndex,
|
|
37
|
+
prevRoot: sendResult.merkleData.prevRoot,
|
|
38
|
+
newRoot: sendResult.merkleData.newRoot,
|
|
39
|
+
serverSignature: sendResult.merkleData.serverSignature,
|
|
40
|
+
serverTimestamp: sendResult.merkleData.serverTimestamp,
|
|
41
|
+
serverPublicKey: sendResult.merkleData.serverPublicKey,
|
|
42
|
+
} : undefined,
|
|
43
|
+
};
|
|
44
|
+
result = { operation: "send_message", result: filteredResult };
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
case "send_file": {
|
|
48
|
+
const sendResult = await send_file(validated.from, normalizeAccountOrMark(validated.to), validated.filePath, validated.options);
|
|
49
|
+
const filteredResult = {
|
|
50
|
+
...sendResult,
|
|
51
|
+
merkleData: sendResult.merkleData ? {
|
|
52
|
+
leafIndex: sendResult.merkleData.leafIndex,
|
|
53
|
+
prevRoot: sendResult.merkleData.prevRoot,
|
|
54
|
+
newRoot: sendResult.merkleData.newRoot,
|
|
55
|
+
serverSignature: sendResult.merkleData.serverSignature,
|
|
56
|
+
serverTimestamp: sendResult.merkleData.serverTimestamp,
|
|
57
|
+
serverPublicKey: sendResult.merkleData.serverPublicKey,
|
|
58
|
+
} : undefined,
|
|
59
|
+
};
|
|
60
|
+
result = { operation: "send_file", result: filteredResult };
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
case "watch_messages": {
|
|
64
|
+
const filter = validated.filter ? {
|
|
65
|
+
...validated.filter,
|
|
66
|
+
peerAddress: validated.filter.peerAddress ? normalizeAccountOrMark(validated.filter.peerAddress) : undefined,
|
|
67
|
+
} : undefined;
|
|
68
|
+
const messages = await watch_messages(filter);
|
|
69
|
+
result = { operation: "watch_messages", result: messages };
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case "extract_zip_messages": {
|
|
73
|
+
const extractedPaths = await extract_zip_messages(validated.account, validated.messages, validated.outputDir);
|
|
74
|
+
result = { operation: "extract_zip_messages", result: extractedPaths };
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
case "generate_wts": {
|
|
78
|
+
const params = validated.params ? {
|
|
79
|
+
...validated.params,
|
|
80
|
+
peerAccount: normalizeAccountOrMark(validated.params.peerAccount),
|
|
81
|
+
} : undefined;
|
|
82
|
+
const wtsResult = await generate_wts(params);
|
|
83
|
+
result = { operation: "generate_wts", result: wtsResult };
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
case "verify_wts": {
|
|
87
|
+
const verifyResult = await verify_wts(validated.wtsFilePath);
|
|
88
|
+
result = { operation: "verify_wts", result: verifyResult };
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case "sign_wts": {
|
|
92
|
+
const signedPath = await sign_wts(validated.wtsFilePath, validated.account, validated.outputPath);
|
|
93
|
+
result = { operation: "sign_wts", result: signedPath };
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
case "wts2html": {
|
|
97
|
+
const htmlResult = await wts2html(validated.wtsPath, validated.options);
|
|
98
|
+
result = { operation: "wts2html", result: htmlResult };
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
case "proof_message": {
|
|
102
|
+
const proofResult = await proof_message(validated.account, validated.messageId, validated.network);
|
|
103
|
+
result = { operation: "proof_message", result: proofResult };
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
case "blacklist": {
|
|
107
|
+
const blacklistParams = {
|
|
108
|
+
account: validated.account,
|
|
109
|
+
op: validated.blacklist.op,
|
|
110
|
+
};
|
|
111
|
+
if ('users' in validated.blacklist) {
|
|
112
|
+
blacklistParams.users = normalizeManyAccountOrMark(validated.blacklist.users);
|
|
113
|
+
}
|
|
114
|
+
const blacklistResult = await blacklist(blacklistParams);
|
|
115
|
+
result = { operation: "blacklist", op: validated.blacklist.op, result: blacklistResult.result };
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case "friendslist": {
|
|
119
|
+
const friendslistParams = {
|
|
120
|
+
account: validated.account,
|
|
121
|
+
op: validated.friendslist.op,
|
|
122
|
+
};
|
|
123
|
+
if ('users' in validated.friendslist) {
|
|
124
|
+
friendslistParams.users = normalizeManyAccountOrMark(validated.friendslist.users);
|
|
125
|
+
}
|
|
126
|
+
const friendslistResult = await friendslist(friendslistParams);
|
|
127
|
+
result = { operation: "friendslist", op: validated.friendslist.op, result: friendslistResult.result };
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case "guardlist": {
|
|
131
|
+
const guardlistResult = await guardlist({
|
|
132
|
+
account: validated.account,
|
|
133
|
+
...validated.guardlist,
|
|
134
|
+
});
|
|
135
|
+
result = { operation: "guardlist", op: validated.guardlist.op, result: guardlistResult.result };
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
138
|
+
case "settings": {
|
|
139
|
+
const settingsResult = await settings({
|
|
140
|
+
account: validated.account,
|
|
141
|
+
...validated.settings,
|
|
142
|
+
});
|
|
143
|
+
result = { operation: "settings", op: validated.settings.op, result: settingsResult.result };
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
case "mark_messages_as_viewed": {
|
|
147
|
+
const markedCount = await mark_messages_as_viewed(validated.messageIds, validated.account);
|
|
148
|
+
result = { operation: "mark_messages_as_viewed", result: markedCount };
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
case "mark_conversation_as_viewed": {
|
|
152
|
+
const markedCount = await mark_conversation_as_viewed(normalizeAccountOrMark(validated.peerAddress), validated.account);
|
|
153
|
+
result = { operation: "mark_conversation_as_viewed", result: markedCount };
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
case "pull_messages": {
|
|
157
|
+
const messages = await pull_messages(validated.account, validated.limit);
|
|
158
|
+
result = { operation: "pull_messages", result: messages };
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
default:
|
|
162
|
+
throw new Error(`Unknown messenger operation: ${opLiteral}`);
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
166
|
+
structuredContent: { result },
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
catch (error) {
|
|
170
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
171
|
+
const ctx = validated ? { operation_type: "messenger_" + validated.operation, data: validated } : undefined;
|
|
172
|
+
const classified = classifyError(errorMessage);
|
|
173
|
+
const errorResult = { operation: "error", error: errorMessage };
|
|
174
|
+
if (classified.error_code !== undefined)
|
|
175
|
+
errorResult.error_code = classified.error_code;
|
|
176
|
+
if (classified.retryable !== undefined)
|
|
177
|
+
errorResult.retryable = classified.retryable;
|
|
178
|
+
if (classified.recovery_hint !== undefined)
|
|
179
|
+
errorResult.recovery_hint = classified.recovery_hint;
|
|
180
|
+
return {
|
|
181
|
+
content: [{ type: "text", text: `Error: ${errorMessage}` }],
|
|
182
|
+
structuredContent: {
|
|
183
|
+
result: errorResult,
|
|
184
|
+
semantic: buildDataSemantic(undefined, ctx, true, errorMessage),
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
}
|