@wowok/agent-mcp 2.5.5 → 2.6.1
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/README.md +5 -3
- package/dist/config/runtime.js +3 -6
- package/dist/extensions/capability-manifest.d.ts +125 -0
- package/dist/extensions/capability-manifest.js +594 -0
- package/dist/extensions/constraint-registry.d.ts +24 -0
- package/dist/extensions/constraint-registry.js +196 -0
- package/dist/extensions/index.d.ts +12 -0
- package/dist/extensions/index.js +6 -0
- package/dist/extensions/metric-registry.d.ts +26 -0
- package/dist/extensions/metric-registry.js +257 -0
- package/dist/extensions/mode-evaluator.d.ts +15 -0
- package/dist/extensions/mode-evaluator.js +170 -0
- package/dist/extensions/modes.d.ts +2 -0
- package/dist/extensions/modes.js +407 -0
- package/dist/extensions/registry.d.ts +48 -0
- package/dist/extensions/registry.js +629 -0
- package/dist/extensions/types.d.ts +218 -0
- package/dist/extensions/types.js +1 -0
- package/dist/harness/checkpoint.js +2 -2
- package/dist/knowledge/deployment-scanner.d.ts +3 -0
- package/dist/knowledge/deployment-scanner.js +64 -3
- package/dist/knowledge/flywheel-loop.js +2 -5
- package/dist/knowledge/guard-risk.d.ts +13 -0
- package/dist/knowledge/guard-risk.js +57 -0
- package/dist/knowledge/guard-templates.js +278 -0
- package/dist/knowledge/machine-templates.js +20 -1
- package/dist/knowledge/overrides-loader.js +2 -4
- package/dist/knowledge/progress-ledger.js +3 -0
- package/dist/knowledge/progress-translation.js +5 -1
- package/dist/knowledge/service-confirm.d.ts +14 -5
- package/dist/knowledge/service-confirm.js +116 -8
- package/dist/knowledge/tool-constraints.js +6 -2
- package/dist/loop-engineering/improve.js +2 -4
- package/dist/project/deployment-bridge.d.ts +5 -0
- package/dist/project/deployment-bridge.js +119 -0
- package/dist/project/deployment-doc.d.ts +3 -0
- package/dist/project/deployment-doc.js +72 -10
- package/dist/project/evaluation.d.ts +2 -0
- package/dist/project/evaluation.js +578 -86
- package/dist/project/graph-builder.d.ts +4 -1
- package/dist/project/graph-builder.js +141 -63
- package/dist/project/graph.d.ts +1 -0
- package/dist/project/handlers.d.ts +221 -5
- package/dist/project/handlers.js +933 -14
- package/dist/project/index.js +2 -6
- package/dist/project/project-store.js +2 -5
- package/dist/project/stage-gate.d.ts +4 -0
- package/dist/project/stage-gate.js +64 -5
- package/dist/project/task-tracker.d.ts +26 -0
- package/dist/project/task-tracker.js +78 -0
- package/dist/safety/preview.js +16 -0
- package/dist/schema/call/allocation.d.ts +16 -16
- package/dist/schema/call/base.d.ts +21 -13
- package/dist/schema/call/base.js +27 -6
- package/dist/schema/call/bridge.d.ts +5 -5
- package/dist/schema/call/bridge.js +3 -1
- package/dist/schema/call/demand.d.ts +23 -31
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/machine.d.ts +402 -376
- package/dist/schema/call/order.d.ts +149 -228
- package/dist/schema/call/order.js +7 -3
- package/dist/schema/call/payment.d.ts +183 -3
- package/dist/schema/call/payment.js +21 -3
- package/dist/schema/call/personal.d.ts +241 -52
- package/dist/schema/call/progress.d.ts +53 -61
- package/dist/schema/call/progress.js +18 -4
- package/dist/schema/call/repository.d.ts +23 -31
- package/dist/schema/call/semantic.d.ts +1 -1
- package/dist/schema/call/semantic.js +30 -1
- package/dist/schema/call/service.d.ts +95 -119
- package/dist/schema/call/service.js +22 -1
- package/dist/schema/common/index.d.ts +11 -2
- package/dist/schema/common/index.js +43 -14
- package/dist/schema/config/index.d.ts +12 -12
- package/dist/schema/local/index.d.ts +140 -143
- package/dist/schema/local/index.js +44 -23
- package/dist/schema/messenger/index.d.ts +290 -62
- package/dist/schema/messenger/index.js +2 -2
- package/dist/schema/operations.d.ts +680 -545
- package/dist/schema/operations.js +22 -0
- package/dist/schema/project/index.d.ts +2064 -84
- package/dist/schema/project/index.js +354 -12
- package/dist/schema/query/index.d.ts +715 -354
- package/dist/schema/query/index.js +164 -31
- package/dist/schema/schema-query/index.d.ts +15 -3
- package/dist/schema/schema-query/index.js +23 -5
- package/dist/schema/trust/index.d.ts +8 -8
- package/dist/schema/utils/node-parser.js +7 -4
- package/dist/schema-query/index.d.ts +7 -1
- package/dist/schema-query/index.js +204 -4
- package/dist/schemas/account_operation.output.json +14 -22
- package/dist/schemas/account_operation.schema.json +11 -25
- package/dist/schemas/bridge_operation.output.json +6 -0
- package/dist/schemas/bridge_operation.schema.json +1 -1
- package/dist/schemas/guard-templates.json +379 -0
- package/dist/schemas/guard2file.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/local_info_operation.output.json +6 -0
- package/dist/schemas/local_mark_operation.output.json +7 -1
- package/dist/schemas/local_mark_operation.schema.json +1 -1
- package/dist/schemas/machineNode2file.schema.json +1 -1
- package/dist/schemas/messenger_operation.schema.json +10 -10
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.schema.json +348 -296
- package/dist/schemas/onchain_operations_allocation.schema.json +34 -25
- package/dist/schemas/onchain_operations_arbitration.schema.json +8 -8
- package/dist/schemas/onchain_operations_contact.schema.json +8 -8
- package/dist/schemas/onchain_operations_demand.schema.json +8 -8
- package/dist/schemas/onchain_operations_gen_passport.schema.json +14 -14
- package/dist/schemas/onchain_operations_gen_proof.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +41 -33
- package/dist/schemas/onchain_operations_order.schema.json +71 -77
- package/dist/schemas/onchain_operations_payment.schema.json +141 -111
- package/dist/schemas/onchain_operations_permission.schema.json +2 -2
- package/dist/schemas/onchain_operations_personal.schema.json +7 -7
- package/dist/schemas/onchain_operations_progress.schema.json +8 -8
- package/dist/schemas/onchain_operations_proof.schema.json +7 -7
- package/dist/schemas/onchain_operations_repository.schema.json +8 -8
- package/dist/schemas/onchain_operations_reward.schema.json +10 -10
- package/dist/schemas/onchain_operations_service.schema.json +46 -35
- package/dist/schemas/onchain_operations_treasury.schema.json +8 -8
- package/dist/schemas/onchain_table_data.output.json +33 -25
- package/dist/schemas/onchain_table_data.schema.json +12 -12
- package/dist/schemas/project_operation.output.json +1352 -20
- package/dist/schemas/project_operation.schema.json +53 -4
- package/dist/schemas/query_toolkit.output.json +111 -82
- package/dist/schemas/query_toolkit.schema.json +9 -13
- package/dist/schemas/schema_query.output.json +7 -3
- package/dist/schemas/schema_query.schema.json +17 -3
- package/dist/telemetry/storage.js +2 -2
- package/dist/tools/handlers/local.js +20 -5
- package/dist/tools/handlers/onchain.js +36 -0
- package/dist/tools/handlers/project.js +72 -1
- package/dist/tools/handlers/query.js +27 -0
- package/dist/tools/handlers/schema-query.js +19 -0
- package/dist/tools/handlers/task-status.d.ts +170 -0
- package/dist/tools/handlers/task-status.js +55 -0
- package/dist/tools/handlers/wip.js +47 -1
- package/dist/tools/index.js +212 -8
- package/dist/tools/retry.d.ts +8 -0
- package/dist/tools/retry.js +85 -0
- package/dist/tools/wip-deploy-assist.d.ts +28 -0
- package/dist/tools/wip-deploy-assist.js +278 -0
- package/package.json +2 -2
- package/dist/schemas/guard-node-examples.md +0 -199
|
@@ -99,10 +99,6 @@
|
|
|
99
99
|
"type": "boolean",
|
|
100
100
|
"description": "Filter accounts with messenger enabled"
|
|
101
101
|
},
|
|
102
|
-
"m": {
|
|
103
|
-
"$ref": "#/definitions/query_toolkit/anyOf/0/properties/filter/properties/name",
|
|
104
|
-
"description": "Filter by messenger name (supports fuzzy match)"
|
|
105
|
-
},
|
|
106
102
|
"createdAt": {
|
|
107
103
|
"type": "object",
|
|
108
104
|
"properties": {
|
|
@@ -294,7 +290,7 @@
|
|
|
294
290
|
"testnet",
|
|
295
291
|
"mainnet"
|
|
296
292
|
],
|
|
297
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on"
|
|
293
|
+
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
|
|
298
294
|
}
|
|
299
295
|
},
|
|
300
296
|
"required": [
|
|
@@ -342,7 +338,7 @@
|
|
|
342
338
|
},
|
|
343
339
|
"network": {
|
|
344
340
|
"$ref": "#/definitions/query_toolkit/anyOf/4/properties/network",
|
|
345
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on"
|
|
341
|
+
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
|
|
346
342
|
}
|
|
347
343
|
},
|
|
348
344
|
"required": [
|
|
@@ -371,7 +367,7 @@
|
|
|
371
367
|
},
|
|
372
368
|
"network": {
|
|
373
369
|
"$ref": "#/definitions/query_toolkit/anyOf/4/properties/network",
|
|
374
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on"
|
|
370
|
+
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
|
|
375
371
|
}
|
|
376
372
|
},
|
|
377
373
|
"required": [
|
|
@@ -391,8 +387,8 @@
|
|
|
391
387
|
"name_or_address": {
|
|
392
388
|
"anyOf": [
|
|
393
389
|
{
|
|
394
|
-
"
|
|
395
|
-
"description": "Account name, address (0x...), or mark name. When using string format, local marks are searched first. EXAMPLE: 'alice' - searches local marks first, then global; EXAMPLE: '
|
|
390
|
+
"$ref": "#/definitions/query_toolkit/anyOf/4/properties/name_or_address",
|
|
391
|
+
"description": "Account name, address (0x...), or mark name. When using string format, local marks are searched first. EXAMPLE: 'alice' - searches local marks first, then global; EXAMPLE: '0x2...' (64 hex chars) - uses address directly; EXAMPLE: '' - uses the default local account"
|
|
396
392
|
},
|
|
397
393
|
{
|
|
398
394
|
"type": "object",
|
|
@@ -447,7 +443,7 @@
|
|
|
447
443
|
},
|
|
448
444
|
"network": {
|
|
449
445
|
"$ref": "#/definitions/query_toolkit/anyOf/4/properties/network",
|
|
450
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on"
|
|
446
|
+
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
|
|
451
447
|
}
|
|
452
448
|
},
|
|
453
449
|
"required": [
|
|
@@ -474,7 +470,7 @@
|
|
|
474
470
|
},
|
|
475
471
|
"network": {
|
|
476
472
|
"$ref": "#/definitions/query_toolkit/anyOf/4/properties/network",
|
|
477
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on"
|
|
473
|
+
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
|
|
478
474
|
}
|
|
479
475
|
},
|
|
480
476
|
"required": [
|
|
@@ -523,7 +519,7 @@
|
|
|
523
519
|
},
|
|
524
520
|
"network": {
|
|
525
521
|
"$ref": "#/definitions/query_toolkit/anyOf/4/properties/network",
|
|
526
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on"
|
|
522
|
+
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
|
|
527
523
|
}
|
|
528
524
|
},
|
|
529
525
|
"required": [
|
|
@@ -579,7 +575,7 @@
|
|
|
579
575
|
},
|
|
580
576
|
"network": {
|
|
581
577
|
"$ref": "#/definitions/query_toolkit/anyOf/4/properties/network",
|
|
582
|
-
"description": "Network entrypoint: Specifies which network the operation occurs on"
|
|
578
|
+
"description": "Network entrypoint: Specifies which network the operation occurs on. FIX-010 cross-network note: LocalMark names are scoped per network (testnet marks are invisible on mainnet and vice versa). When migrating from testnet to mainnet, recreate all objects on mainnet and re-register LocalMark names with the SAME names to keep name-based references working across networks. Use project_operation action='clone_project_to_network' to clone the project blueprint to the target network, then re-run onchain_operations with env.network=target_network to deploy."
|
|
583
579
|
}
|
|
584
580
|
},
|
|
585
581
|
"required": [
|
|
@@ -46,14 +46,14 @@
|
|
|
46
46
|
{
|
|
47
47
|
"type": "object",
|
|
48
48
|
"additionalProperties": {},
|
|
49
|
-
"description": "JSON Schema object (get/get_output)."
|
|
49
|
+
"description": "JSON Schema object (get/get_output/get_field) or Guard template data."
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
"type": "null",
|
|
53
|
-
"description": "No data — lookup failed or returned nothing."
|
|
53
|
+
"description": "No data — lookup failed or returned nothing, or data was written to output_file."
|
|
54
54
|
}
|
|
55
55
|
],
|
|
56
|
-
"description": "Response data — array of schema summaries for list-like actions, JSON Schema object for get/get_output, null on failure."
|
|
56
|
+
"description": "Response data — array of schema summaries for list-like actions, JSON Schema object for get/get_output/get_field, Guard template data for get_guard_templates, null on failure or when output_file is used."
|
|
57
57
|
},
|
|
58
58
|
"message": {
|
|
59
59
|
"type": "string",
|
|
@@ -65,6 +65,10 @@
|
|
|
65
65
|
"type": "string"
|
|
66
66
|
},
|
|
67
67
|
"description": "Suggested next steps or alternatives"
|
|
68
|
+
},
|
|
69
|
+
"output_file_path": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"description": "When output_file is used, contains the absolute file path where data was written."
|
|
68
72
|
}
|
|
69
73
|
},
|
|
70
74
|
"required": [
|
|
@@ -15,17 +15,31 @@
|
|
|
15
15
|
"get",
|
|
16
16
|
"get_output",
|
|
17
17
|
"search",
|
|
18
|
-
"list_operations"
|
|
18
|
+
"list_operations",
|
|
19
|
+
"get_guard_templates",
|
|
20
|
+
"get_field"
|
|
19
21
|
],
|
|
20
|
-
"description": "Action to perform: 'list'
|
|
22
|
+
"description": "Action to perform: 'list' (all schemas), 'get' (specific input schema), 'get_output' (tool output schema), 'get_field' (field-path query e.g. field_path='data.node'), 'search' (by keyword), 'list_operations' (on-chain operations), 'get_guard_templates' (Guard creation templates + best practices)."
|
|
21
23
|
},
|
|
22
24
|
"name": {
|
|
23
25
|
"type": "string",
|
|
24
|
-
"description": "Schema/tool name for 'get'/'get_output' action (e.g., 'onchain_operations', '
|
|
26
|
+
"description": "Schema/tool name for 'get'/'get_output'/'get_field' action (e.g., 'onchain_operations', 'onchain_operations_machine')."
|
|
25
27
|
},
|
|
26
28
|
"query": {
|
|
27
29
|
"type": "string",
|
|
28
30
|
"description": "Search query for 'search' action"
|
|
31
|
+
},
|
|
32
|
+
"field_path": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"description": "Dot-separated field path for 'get_field' action (e.g. 'data.node', 'data.node.nodes.0.pairs'). Navigates schema.properties.* and schema.items.*."
|
|
35
|
+
},
|
|
36
|
+
"template": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "Guard template name for 'get_guard_templates' action. Omit to list all available templates. Available: signer_verification, progress_node_check, order_owner_verification, service_belonging_check, reward_not_claimed, combined_reward_guard."
|
|
39
|
+
},
|
|
40
|
+
"output_file": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "When set, writes the response data to this file path (relative to cwd) and returns the path instead of inline data. Use for large schemas that would be truncated. Prefer workspace paths like '.trae/tmp/schema.json' so the Read tool can access them."
|
|
29
43
|
}
|
|
30
44
|
},
|
|
31
45
|
"required": [
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { mkdir, appendFile, stat, rename } from "fs/promises";
|
|
2
2
|
import { dirname, join } from "path";
|
|
3
|
-
import {
|
|
3
|
+
import { getWowMcpDir } from "@wowok/wowok";
|
|
4
4
|
const MAX_SIZE_BYTES = 10 * 1024 * 1024;
|
|
5
|
-
const DATA_DIR = join(
|
|
5
|
+
const DATA_DIR = join(getWowMcpDir(), "data");
|
|
6
6
|
const TELEMETRY_FILE = join(DATA_DIR, "telemetry.jsonl");
|
|
7
7
|
const ROTATED_FILE = join(DATA_DIR, "telemetry.jsonl.1");
|
|
8
8
|
class JsonlStorage {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { wrapLocalHandler } from "../shared.js";
|
|
2
|
+
import { withFaucetRetry } from "../retry.js";
|
|
2
3
|
import { AccountOperationSchema, LocalMarkOperationSchema, LocalInfoOperationSchema, } from "../../schema/index.js";
|
|
3
4
|
import { account_operation, local_mark_operation, local_info_operation, } from "@wowok/wowok";
|
|
4
5
|
function deriveOpType(prefix, validated) {
|
|
@@ -11,7 +12,7 @@ function deriveOpType(prefix, validated) {
|
|
|
11
12
|
}
|
|
12
13
|
export const handleAccountOperation = wrapLocalHandler({
|
|
13
14
|
schema: AccountOperationSchema,
|
|
14
|
-
operationFn: account_operation,
|
|
15
|
+
operationFn: withFaucetRetry(account_operation),
|
|
15
16
|
parseLabel: "account_operation input",
|
|
16
17
|
buildContext: (validated) => ({
|
|
17
18
|
operation_type: deriveOpType("account", validated),
|
|
@@ -22,10 +23,24 @@ export const handleMarkOperation = wrapLocalHandler({
|
|
|
22
23
|
schema: LocalMarkOperationSchema,
|
|
23
24
|
operationFn: local_mark_operation,
|
|
24
25
|
parseLabel: "local_mark_operation input",
|
|
25
|
-
buildContext: (validated) =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
buildContext: (validated) => {
|
|
27
|
+
const ctx = {
|
|
28
|
+
operation_type: deriveOpType("mark", validated),
|
|
29
|
+
data: validated,
|
|
30
|
+
};
|
|
31
|
+
const v = validated;
|
|
32
|
+
if (v.add && Array.isArray(v.add.data) && v.add.data.length > 0) {
|
|
33
|
+
ctx.pre_warnings = [
|
|
34
|
+
"Cross-network consistency (FIX-011): LocalMark names are scoped per network. " +
|
|
35
|
+
"When creating marks for the same logical object on different networks " +
|
|
36
|
+
"(e.g. testnet and mainnet), use the SAME name value to keep name-based " +
|
|
37
|
+
"references portable. Before creating a mark on mainnet, consider querying " +
|
|
38
|
+
"testnet via query_local with network='testnet' to check for an existing " +
|
|
39
|
+
"same-named mark and replicate it.",
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
return ctx;
|
|
43
|
+
},
|
|
29
44
|
});
|
|
30
45
|
export const handleInfoOperation = wrapLocalHandler({
|
|
31
46
|
schema: LocalInfoOperationSchema,
|
|
@@ -81,6 +81,15 @@ export async function handleOnchainOperations(args) {
|
|
|
81
81
|
validated.data = pn.data;
|
|
82
82
|
projectWarnings = pn.warnings ?? [];
|
|
83
83
|
}
|
|
84
|
+
if (!env.account && projectEnvPrefix) {
|
|
85
|
+
try {
|
|
86
|
+
const project = await LocalProject.Instance().getProjectByPrefix(projectEnvPrefix);
|
|
87
|
+
if (project?.defaultAccount) {
|
|
88
|
+
env.account = project.defaultAccount;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
catch { }
|
|
92
|
+
}
|
|
84
93
|
delete env.confirmed;
|
|
85
94
|
delete env.user_intent_phrases;
|
|
86
95
|
delete env.project;
|
|
@@ -94,6 +103,15 @@ export async function handleOnchainOperations(args) {
|
|
|
94
103
|
: await callService.call(env);
|
|
95
104
|
const data = validated.data;
|
|
96
105
|
const intent = data?.publish ? "publish service" : data?.bPublished !== undefined ? "modify service" : "create service";
|
|
106
|
+
const isCreatingService = data?.object != null && typeof data.object === "object";
|
|
107
|
+
const hasCompensationFundAdd = data?.compensation_fund_add != null;
|
|
108
|
+
if (isCreatingService && !hasCompensationFundAdd) {
|
|
109
|
+
constraintWarnings.push("Service.compensation_fund balance is 0 — no refund protection for buyers. " +
|
|
110
|
+
"If buyers need refund protection, call service.compensation_fund_add with a Coin<T> " +
|
|
111
|
+
"to deposit. Without deposit, arbitration rulings cannot withdraw compensation " +
|
|
112
|
+
"from this Service. (Note: some industries like freelance do not require this; " +
|
|
113
|
+
"the evaluation engine will check industry-specific requirements.)");
|
|
114
|
+
}
|
|
97
115
|
const output = handleCallResult(result, withHarness(buildCtx(data), "service", intent));
|
|
98
116
|
autoAddToProject(projectEnvPrefix, validated.operation_type, result).catch(() => { });
|
|
99
117
|
return output;
|
|
@@ -132,6 +150,13 @@ export async function handleOnchainOperations(args) {
|
|
|
132
150
|
return output;
|
|
133
151
|
}
|
|
134
152
|
case "progress": {
|
|
153
|
+
if (validated.data?.operate) {
|
|
154
|
+
constraintWarnings.push("Progress routing hint: if this Progress is bound to an Order and the target " +
|
|
155
|
+
"Forward uses namedOperator=\"\" (empty string = OrderHolder), use " +
|
|
156
|
+
"order.progress (NOT progress.operate). Direct progress::next fails with " +
|
|
157
|
+
"Permission denied for OrderHolder forwards. Use progress.operate only for " +
|
|
158
|
+
"non-empty namedOperator or permissionIndex-only forwards.");
|
|
159
|
+
}
|
|
135
160
|
const callProgress = new CallProgress(validated.data);
|
|
136
161
|
const result = validated.submission
|
|
137
162
|
? await callProgress.call_with_submission(env, await transformSubmission(validated.submission))
|
|
@@ -281,6 +306,17 @@ export async function handleOnchainOperations(args) {
|
|
|
281
306
|
return output;
|
|
282
307
|
}
|
|
283
308
|
case "order": {
|
|
309
|
+
if (validated.data?.progress) {
|
|
310
|
+
constraintWarnings.push("Order routing hint: order.progress works only for Forwards with " +
|
|
311
|
+
"namedOperator=\"\" (OrderHolder). If the target Forward uses a " +
|
|
312
|
+
"non-empty namedOperator or permissionIndex-only, use progress.operate " +
|
|
313
|
+
"on the Progress object directly instead.");
|
|
314
|
+
constraintWarnings.push("Allocation hint: if this operation advances the order to a terminal " +
|
|
315
|
+
"state (e.g. Completed/Cancelled/Refunded), funds remain in the " +
|
|
316
|
+
"Allocation object and are NOT auto-distributed. To release funds, " +
|
|
317
|
+
"trigger the corresponding Guard verification via allocation operation " +
|
|
318
|
+
"(the Guard bound to the matching Allocator will verify and distribute).");
|
|
319
|
+
}
|
|
284
320
|
const callOrder = new CallOrder(validated.data);
|
|
285
321
|
const result = validated.submission
|
|
286
322
|
? await callOrder.call_with_submission(env, await transformSubmission(validated.submission))
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { assembleContext } from "../../project/context-assembly.js";
|
|
2
|
-
import {
|
|
2
|
+
import { generateDeploymentDocFromProject } from "../../project/deployment-bridge.js";
|
|
3
|
+
import { LocalProject } from "@wowok/wowok";
|
|
4
|
+
import { validateStageGate } from "../../project/stage-gate.js";
|
|
5
|
+
import { scanDeployment } from "../../knowledge/deployment-scanner.js";
|
|
6
|
+
import { handleListProjects, handleCreateProject, handleCreateProjectFromOnchain, handleUpdateProject, handleGetProjectDetail, handleAddObject, handleRemoveObject, handleUpdateObject, handleCreateVersion, handleBuildGraph, handleGetGraph, handleEvaluateProject, handleSaveEvaluation, handleCompareProjects, handleRefreshObjects, handleGetObjectDiff, handleDeleteProject, handleGetMachineGraph, handlePreEvaluateCheck, handleVerifyDeployment, handleCloneProjectToNetwork, } from "../../project/handlers.js";
|
|
3
7
|
import { strictParse } from "../../schema/index.js";
|
|
4
8
|
import { ProjectOperationInputSchema } from "../../schema/project/index.js";
|
|
9
|
+
import { getStageCache } from "../../project/index.js";
|
|
5
10
|
export async function handleProjectOperation(args) {
|
|
6
11
|
const validated = strictParse(ProjectOperationInputSchema, args, "project_operation input");
|
|
7
12
|
const { action } = validated;
|
|
@@ -58,9 +63,75 @@ export async function handleProjectOperation(args) {
|
|
|
58
63
|
case "delete_project":
|
|
59
64
|
result = await handleDeleteProject(validated);
|
|
60
65
|
break;
|
|
66
|
+
case "get_machine_graph":
|
|
67
|
+
result = await handleGetMachineGraph(validated);
|
|
68
|
+
break;
|
|
61
69
|
case "assemble_context":
|
|
62
70
|
result = await assembleContext(validated);
|
|
63
71
|
break;
|
|
72
|
+
case "generate_deployment_doc": {
|
|
73
|
+
const { project_id, network, save = true, detail_level } = validated;
|
|
74
|
+
if (!project_id) {
|
|
75
|
+
throw new Error("'project_id' is required for generate_deployment_doc");
|
|
76
|
+
}
|
|
77
|
+
if (!network) {
|
|
78
|
+
throw new Error("'network' is required for generate_deployment_doc");
|
|
79
|
+
}
|
|
80
|
+
const genResult = await generateDeploymentDocFromProject(project_id, network, detail_level);
|
|
81
|
+
if (save) {
|
|
82
|
+
await LocalProject.Instance().saveDocument(project_id, network, genResult.markdown);
|
|
83
|
+
}
|
|
84
|
+
const project = await LocalProject.Instance().getProject(project_id);
|
|
85
|
+
const stageEntry = getStageCache(project?.prefix ?? project_id, project?.currentVersion ?? "v1");
|
|
86
|
+
const stageGateResult = validateStageGate({
|
|
87
|
+
stage: 4,
|
|
88
|
+
prefix: project?.prefix ?? project_id,
|
|
89
|
+
version: project?.currentVersion ?? "v1",
|
|
90
|
+
objects: [],
|
|
91
|
+
risk_status: stageEntry?.risk_status,
|
|
92
|
+
risk_can_proceed: stageEntry?.risk_can_proceed,
|
|
93
|
+
has_published_object: false,
|
|
94
|
+
deployment_doc_generated: true,
|
|
95
|
+
});
|
|
96
|
+
const scanResult = scanDeployment({
|
|
97
|
+
project_name: project?.prefix ?? project_id,
|
|
98
|
+
});
|
|
99
|
+
result = {
|
|
100
|
+
action: "generate_deployment_doc",
|
|
101
|
+
markdown: genResult.markdown,
|
|
102
|
+
validation: genResult.validation,
|
|
103
|
+
saved: save,
|
|
104
|
+
detail_level: detail_level ?? "summary",
|
|
105
|
+
stage_gate: {
|
|
106
|
+
stage: stageGateResult.stage,
|
|
107
|
+
passed: stageGateResult.passed,
|
|
108
|
+
can_proceed: stageGateResult.can_proceed,
|
|
109
|
+
blocking_issues: stageGateResult.blocking_issues,
|
|
110
|
+
warnings: stageGateResult.warnings,
|
|
111
|
+
checks: stageGateResult.checks,
|
|
112
|
+
},
|
|
113
|
+
deployment_scan: {
|
|
114
|
+
overall_readiness: scanResult.overall_readiness,
|
|
115
|
+
critical_count: scanResult.findings.filter(f => f.severity === "critical").length,
|
|
116
|
+
warning_count: scanResult.findings.filter(f => f.severity === "warning").length,
|
|
117
|
+
findings: scanResult.findings,
|
|
118
|
+
checks: scanResult.checks,
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
case "pre_evaluate_check":
|
|
124
|
+
result = await handlePreEvaluateCheck(validated);
|
|
125
|
+
break;
|
|
126
|
+
case "verify_deployment":
|
|
127
|
+
result = await handleVerifyDeployment(validated);
|
|
128
|
+
break;
|
|
129
|
+
case "clone_project_to_network":
|
|
130
|
+
result = await handleCloneProjectToNetwork(validated);
|
|
131
|
+
break;
|
|
132
|
+
case "migrate_network":
|
|
133
|
+
result = await handleCloneProjectToNetwork(validated);
|
|
134
|
+
break;
|
|
64
135
|
default:
|
|
65
136
|
throw new Error(`Unknown project_operation action: ${String(action)}`);
|
|
66
137
|
}
|
|
@@ -73,6 +73,33 @@ export async function handleWatchQueryOperations(args) {
|
|
|
73
73
|
}
|
|
74
74
|
return obj;
|
|
75
75
|
});
|
|
76
|
+
queryResult.objects = queryResult.objects.map((obj) => {
|
|
77
|
+
if (obj && obj.data && obj.data.type === "Progress" && obj.data.current === "") {
|
|
78
|
+
const machineId = obj.data.machine;
|
|
79
|
+
const taskId = obj.data.task;
|
|
80
|
+
return {
|
|
81
|
+
...obj,
|
|
82
|
+
_diagnostic: {
|
|
83
|
+
issue: "Progress.current is empty — order workflow is stuck at the initial state",
|
|
84
|
+
cause: "The Machine's entry node (prev_node='') likely has no forwards defined. " +
|
|
85
|
+
"When Progress starts, it looks up the entry node's forwards to determine " +
|
|
86
|
+
"the next node. Without forwards, Progress cannot advance and the order " +
|
|
87
|
+
"is permanently stuck.",
|
|
88
|
+
machine_object_id: machineId ?? null,
|
|
89
|
+
bound_order_id: taskId ?? null,
|
|
90
|
+
fix: [
|
|
91
|
+
"1. Query the Machine object (use query_toolkit with query_type='onchain_objects' and objects=[" + JSON.stringify(machineId) + "]).",
|
|
92
|
+
"2. Inspect node.pairs for the entry node (prev_node='').",
|
|
93
|
+
"3. If forwards is empty: this is the root cause. The Machine must be republished with at least one forward on the entry node.",
|
|
94
|
+
"4. To republish: clone the Machine nodes, add a forward to the entry node's pairs, then create a new Machine (Machine nodes are immutable after publish — see P0-2 schema validation that now blocks this).",
|
|
95
|
+
"5. Rebind the new Machine to the Service (service.machine field) and create a new Order to test.",
|
|
96
|
+
],
|
|
97
|
+
reference: "P0-2 schema refinement in MachineNodePairSchema ensures new Machines cannot be published with empty entry-node forwards. This diagnostic catches legacy Machines that predate the fix.",
|
|
98
|
+
},
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
return obj;
|
|
102
|
+
});
|
|
76
103
|
}
|
|
77
104
|
result = { query_type: "onchain_objects", result: queryResult };
|
|
78
105
|
break;
|
|
@@ -7,9 +7,16 @@ export async function handleSchemaQuery(args) {
|
|
|
7
7
|
action: validated.action,
|
|
8
8
|
name: validated.name,
|
|
9
9
|
query: validated.query,
|
|
10
|
+
field_path: validated.field_path,
|
|
11
|
+
template: validated.template,
|
|
12
|
+
output_file: validated.output_file,
|
|
10
13
|
};
|
|
11
14
|
const response = processSchemaQuery(request);
|
|
12
15
|
let textContent = response.message;
|
|
16
|
+
if (response.output_file_path) {
|
|
17
|
+
textContent += `\n\n📄 Full data written to: ${response.output_file_path}`;
|
|
18
|
+
textContent += `\n Use the Read tool to access the file content.`;
|
|
19
|
+
}
|
|
13
20
|
const data = response.data;
|
|
14
21
|
if (response.success && data) {
|
|
15
22
|
switch (request.action) {
|
|
@@ -55,6 +62,18 @@ export async function handleSchemaQuery(args) {
|
|
|
55
62
|
textContent += JSON.stringify(data, null, 2);
|
|
56
63
|
textContent += "\n```\n";
|
|
57
64
|
break;
|
|
65
|
+
case "get_guard_templates":
|
|
66
|
+
textContent += "\n\n## Guard Templates\n\n";
|
|
67
|
+
textContent += "```json\n";
|
|
68
|
+
textContent += JSON.stringify(data, null, 2);
|
|
69
|
+
textContent += "\n```\n";
|
|
70
|
+
break;
|
|
71
|
+
case "get_field":
|
|
72
|
+
textContent += "\n\n## Field Schema\n\n";
|
|
73
|
+
textContent += "```json\n";
|
|
74
|
+
textContent += JSON.stringify(data, null, 2);
|
|
75
|
+
textContent += "\n```\n";
|
|
76
|
+
break;
|
|
58
77
|
case "search":
|
|
59
78
|
if (Array.isArray(data) && data.length > 0) {
|
|
60
79
|
textContent += `\n\nFound ${data.length} schemas matching '${request.query ?? ""}':\n`;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ToolDispatchResult } from "../types.js";
|
|
3
|
+
export declare const QueryTaskStatusInputSchema: z.ZodObject<{
|
|
4
|
+
task_id: z.ZodOptional<z.ZodString>;
|
|
5
|
+
project_id: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, "strict", z.ZodTypeAny, {
|
|
7
|
+
project_id?: string | undefined;
|
|
8
|
+
task_id?: string | undefined;
|
|
9
|
+
}, {
|
|
10
|
+
project_id?: string | undefined;
|
|
11
|
+
task_id?: string | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const TaskStateSchema: z.ZodObject<{
|
|
14
|
+
task_id: z.ZodString;
|
|
15
|
+
operation: z.ZodString;
|
|
16
|
+
status: z.ZodEnum<["pending", "running", "completed", "failed", "cancelled"]>;
|
|
17
|
+
progress: z.ZodNumber;
|
|
18
|
+
message: z.ZodString;
|
|
19
|
+
result: z.ZodNullable<z.ZodUnknown>;
|
|
20
|
+
error: z.ZodNullable<z.ZodString>;
|
|
21
|
+
started_at: z.ZodNumber;
|
|
22
|
+
completed_at: z.ZodNullable<z.ZodNumber>;
|
|
23
|
+
project_id: z.ZodNullable<z.ZodString>;
|
|
24
|
+
}, "strict", z.ZodTypeAny, {
|
|
25
|
+
message: string;
|
|
26
|
+
status: "failed" | "completed" | "pending" | "cancelled" | "running";
|
|
27
|
+
error: string | null;
|
|
28
|
+
operation: string;
|
|
29
|
+
progress: number;
|
|
30
|
+
completed_at: number | null;
|
|
31
|
+
project_id: string | null;
|
|
32
|
+
task_id: string;
|
|
33
|
+
started_at: number;
|
|
34
|
+
result?: unknown;
|
|
35
|
+
}, {
|
|
36
|
+
message: string;
|
|
37
|
+
status: "failed" | "completed" | "pending" | "cancelled" | "running";
|
|
38
|
+
error: string | null;
|
|
39
|
+
operation: string;
|
|
40
|
+
progress: number;
|
|
41
|
+
completed_at: number | null;
|
|
42
|
+
project_id: string | null;
|
|
43
|
+
task_id: string;
|
|
44
|
+
started_at: number;
|
|
45
|
+
result?: unknown;
|
|
46
|
+
}>;
|
|
47
|
+
export declare const QueryTaskStatusOutputSchema: z.ZodObject<{
|
|
48
|
+
task_id: z.ZodOptional<z.ZodString>;
|
|
49
|
+
task: z.ZodNullable<z.ZodObject<{
|
|
50
|
+
task_id: z.ZodString;
|
|
51
|
+
operation: z.ZodString;
|
|
52
|
+
status: z.ZodEnum<["pending", "running", "completed", "failed", "cancelled"]>;
|
|
53
|
+
progress: z.ZodNumber;
|
|
54
|
+
message: z.ZodString;
|
|
55
|
+
result: z.ZodNullable<z.ZodUnknown>;
|
|
56
|
+
error: z.ZodNullable<z.ZodString>;
|
|
57
|
+
started_at: z.ZodNumber;
|
|
58
|
+
completed_at: z.ZodNullable<z.ZodNumber>;
|
|
59
|
+
project_id: z.ZodNullable<z.ZodString>;
|
|
60
|
+
}, "strict", z.ZodTypeAny, {
|
|
61
|
+
message: string;
|
|
62
|
+
status: "failed" | "completed" | "pending" | "cancelled" | "running";
|
|
63
|
+
error: string | null;
|
|
64
|
+
operation: string;
|
|
65
|
+
progress: number;
|
|
66
|
+
completed_at: number | null;
|
|
67
|
+
project_id: string | null;
|
|
68
|
+
task_id: string;
|
|
69
|
+
started_at: number;
|
|
70
|
+
result?: unknown;
|
|
71
|
+
}, {
|
|
72
|
+
message: string;
|
|
73
|
+
status: "failed" | "completed" | "pending" | "cancelled" | "running";
|
|
74
|
+
error: string | null;
|
|
75
|
+
operation: string;
|
|
76
|
+
progress: number;
|
|
77
|
+
completed_at: number | null;
|
|
78
|
+
project_id: string | null;
|
|
79
|
+
task_id: string;
|
|
80
|
+
started_at: number;
|
|
81
|
+
result?: unknown;
|
|
82
|
+
}>>;
|
|
83
|
+
tasks: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
|
+
task_id: z.ZodString;
|
|
85
|
+
operation: z.ZodString;
|
|
86
|
+
status: z.ZodEnum<["pending", "running", "completed", "failed", "cancelled"]>;
|
|
87
|
+
progress: z.ZodNumber;
|
|
88
|
+
message: z.ZodString;
|
|
89
|
+
result: z.ZodNullable<z.ZodUnknown>;
|
|
90
|
+
error: z.ZodNullable<z.ZodString>;
|
|
91
|
+
started_at: z.ZodNumber;
|
|
92
|
+
completed_at: z.ZodNullable<z.ZodNumber>;
|
|
93
|
+
project_id: z.ZodNullable<z.ZodString>;
|
|
94
|
+
}, "strict", z.ZodTypeAny, {
|
|
95
|
+
message: string;
|
|
96
|
+
status: "failed" | "completed" | "pending" | "cancelled" | "running";
|
|
97
|
+
error: string | null;
|
|
98
|
+
operation: string;
|
|
99
|
+
progress: number;
|
|
100
|
+
completed_at: number | null;
|
|
101
|
+
project_id: string | null;
|
|
102
|
+
task_id: string;
|
|
103
|
+
started_at: number;
|
|
104
|
+
result?: unknown;
|
|
105
|
+
}, {
|
|
106
|
+
message: string;
|
|
107
|
+
status: "failed" | "completed" | "pending" | "cancelled" | "running";
|
|
108
|
+
error: string | null;
|
|
109
|
+
operation: string;
|
|
110
|
+
progress: number;
|
|
111
|
+
completed_at: number | null;
|
|
112
|
+
project_id: string | null;
|
|
113
|
+
task_id: string;
|
|
114
|
+
started_at: number;
|
|
115
|
+
result?: unknown;
|
|
116
|
+
}>, "many">>;
|
|
117
|
+
}, "strict", z.ZodTypeAny, {
|
|
118
|
+
task: {
|
|
119
|
+
message: string;
|
|
120
|
+
status: "failed" | "completed" | "pending" | "cancelled" | "running";
|
|
121
|
+
error: string | null;
|
|
122
|
+
operation: string;
|
|
123
|
+
progress: number;
|
|
124
|
+
completed_at: number | null;
|
|
125
|
+
project_id: string | null;
|
|
126
|
+
task_id: string;
|
|
127
|
+
started_at: number;
|
|
128
|
+
result?: unknown;
|
|
129
|
+
} | null;
|
|
130
|
+
task_id?: string | undefined;
|
|
131
|
+
tasks?: {
|
|
132
|
+
message: string;
|
|
133
|
+
status: "failed" | "completed" | "pending" | "cancelled" | "running";
|
|
134
|
+
error: string | null;
|
|
135
|
+
operation: string;
|
|
136
|
+
progress: number;
|
|
137
|
+
completed_at: number | null;
|
|
138
|
+
project_id: string | null;
|
|
139
|
+
task_id: string;
|
|
140
|
+
started_at: number;
|
|
141
|
+
result?: unknown;
|
|
142
|
+
}[] | undefined;
|
|
143
|
+
}, {
|
|
144
|
+
task: {
|
|
145
|
+
message: string;
|
|
146
|
+
status: "failed" | "completed" | "pending" | "cancelled" | "running";
|
|
147
|
+
error: string | null;
|
|
148
|
+
operation: string;
|
|
149
|
+
progress: number;
|
|
150
|
+
completed_at: number | null;
|
|
151
|
+
project_id: string | null;
|
|
152
|
+
task_id: string;
|
|
153
|
+
started_at: number;
|
|
154
|
+
result?: unknown;
|
|
155
|
+
} | null;
|
|
156
|
+
task_id?: string | undefined;
|
|
157
|
+
tasks?: {
|
|
158
|
+
message: string;
|
|
159
|
+
status: "failed" | "completed" | "pending" | "cancelled" | "running";
|
|
160
|
+
error: string | null;
|
|
161
|
+
operation: string;
|
|
162
|
+
progress: number;
|
|
163
|
+
completed_at: number | null;
|
|
164
|
+
project_id: string | null;
|
|
165
|
+
task_id: string;
|
|
166
|
+
started_at: number;
|
|
167
|
+
result?: unknown;
|
|
168
|
+
}[] | undefined;
|
|
169
|
+
}>;
|
|
170
|
+
export declare function handleQueryTaskStatus(args: unknown): Promise<ToolDispatchResult>;
|