@wowok/agent-mcp 2.6.0 → 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/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/knowledge/deployment-scanner.d.ts +3 -0
- package/dist/knowledge/deployment-scanner.js +64 -3
- 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/service-confirm.d.ts +14 -5
- package/dist/knowledge/service-confirm.js +116 -8
- package/dist/knowledge/tool-constraints.js +6 -2
- package/dist/project/deployment-bridge.d.ts +1 -1
- package/dist/project/deployment-bridge.js +27 -4
- 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 +569 -84
- package/dist/project/graph-builder.d.ts +4 -1
- package/dist/project/graph-builder.js +126 -61
- package/dist/project/graph.d.ts +1 -0
- package/dist/project/handlers.d.ts +219 -5
- package/dist/project/handlers.js +819 -9
- 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/local/index.d.ts +32 -35
- package/dist/schema/local/index.js +23 -5
- package/dist/schema/messenger/index.d.ts +274 -46
- package/dist/schema/operations.d.ts +680 -539
- package/dist/schema/operations.js +22 -0
- package/dist/schema/project/index.d.ts +1796 -80
- package/dist/schema/project/index.js +304 -14
- package/dist/schema/query/index.d.ts +705 -349
- 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/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 +7 -1
- package/dist/schemas/account_operation.schema.json +2 -2
- 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 +4 -4
- 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 +1175 -23
- package/dist/schemas/project_operation.schema.json +40 -4
- package/dist/schemas/query_toolkit.output.json +104 -76
- package/dist/schemas/query_toolkit.schema.json +9 -9
- package/dist/schemas/schema_query.output.json +7 -3
- package/dist/schemas/schema_query.schema.json +17 -3
- package/dist/tools/handlers/local.js +20 -5
- package/dist/tools/handlers/onchain.js +23 -0
- package/dist/tools/handlers/project.js +52 -3
- 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 +211 -7
- 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
|
@@ -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,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;
|
|
@@ -293,6 +311,11 @@ export async function handleOnchainOperations(args) {
|
|
|
293
311
|
"namedOperator=\"\" (OrderHolder). If the target Forward uses a " +
|
|
294
312
|
"non-empty namedOperator or permissionIndex-only, use progress.operate " +
|
|
295
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).");
|
|
296
319
|
}
|
|
297
320
|
const callOrder = new CallOrder(validated.data);
|
|
298
321
|
const result = validated.submission
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { assembleContext } from "../../project/context-assembly.js";
|
|
2
2
|
import { generateDeploymentDocFromProject } from "../../project/deployment-bridge.js";
|
|
3
3
|
import { LocalProject } from "@wowok/wowok";
|
|
4
|
-
import {
|
|
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";
|
|
5
7
|
import { strictParse } from "../../schema/index.js";
|
|
6
8
|
import { ProjectOperationInputSchema } from "../../schema/project/index.js";
|
|
9
|
+
import { getStageCache } from "../../project/index.js";
|
|
7
10
|
export async function handleProjectOperation(args) {
|
|
8
11
|
const validated = strictParse(ProjectOperationInputSchema, args, "project_operation input");
|
|
9
12
|
const { action } = validated;
|
|
@@ -60,29 +63,75 @@ export async function handleProjectOperation(args) {
|
|
|
60
63
|
case "delete_project":
|
|
61
64
|
result = await handleDeleteProject(validated);
|
|
62
65
|
break;
|
|
66
|
+
case "get_machine_graph":
|
|
67
|
+
result = await handleGetMachineGraph(validated);
|
|
68
|
+
break;
|
|
63
69
|
case "assemble_context":
|
|
64
70
|
result = await assembleContext(validated);
|
|
65
71
|
break;
|
|
66
72
|
case "generate_deployment_doc": {
|
|
67
|
-
const { project_id, network, save = true } = validated;
|
|
73
|
+
const { project_id, network, save = true, detail_level } = validated;
|
|
68
74
|
if (!project_id) {
|
|
69
75
|
throw new Error("'project_id' is required for generate_deployment_doc");
|
|
70
76
|
}
|
|
71
77
|
if (!network) {
|
|
72
78
|
throw new Error("'network' is required for generate_deployment_doc");
|
|
73
79
|
}
|
|
74
|
-
const genResult = await generateDeploymentDocFromProject(project_id, network);
|
|
80
|
+
const genResult = await generateDeploymentDocFromProject(project_id, network, detail_level);
|
|
75
81
|
if (save) {
|
|
76
82
|
await LocalProject.Instance().saveDocument(project_id, network, genResult.markdown);
|
|
77
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
|
+
});
|
|
78
99
|
result = {
|
|
79
100
|
action: "generate_deployment_doc",
|
|
80
101
|
markdown: genResult.markdown,
|
|
81
102
|
validation: genResult.validation,
|
|
82
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
|
+
},
|
|
83
120
|
};
|
|
84
121
|
break;
|
|
85
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;
|
|
86
135
|
default:
|
|
87
136
|
throw new Error(`Unknown project_operation action: ${String(action)}`);
|
|
88
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>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { TaskTracker } from "../../project/task-tracker.js";
|
|
3
|
+
export const QueryTaskStatusInputSchema = z.object({
|
|
4
|
+
task_id: z
|
|
5
|
+
.string()
|
|
6
|
+
.optional()
|
|
7
|
+
.describe("The task ID to query (returned by a prior async operation). " +
|
|
8
|
+
"If omitted, lists all recent tasks (most recent first, max 50)."),
|
|
9
|
+
project_id: z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.describe("Optional filter — when listing tasks (task_id omitted), only return tasks for this project."),
|
|
13
|
+
}).strict().describe("Query the status of an async task, or list all recent tasks when task_id is omitted.");
|
|
14
|
+
export const TaskStateSchema = z.object({
|
|
15
|
+
task_id: z.string().describe("Unique task identifier."),
|
|
16
|
+
operation: z.string().describe("Operation type that created this task (e.g. 'build_graph')."),
|
|
17
|
+
status: z.enum(["pending", "running", "completed", "failed", "cancelled"]).describe("Current task status."),
|
|
18
|
+
progress: z.number().describe("Progress percentage 0-100."),
|
|
19
|
+
message: z.string().describe("Human-readable progress message."),
|
|
20
|
+
result: z.unknown().nullable().describe("Result payload (set when status='completed'). null otherwise."),
|
|
21
|
+
error: z.string().nullable().describe("Error message (set when status='failed'). null otherwise."),
|
|
22
|
+
started_at: z.number().describe("Timestamp (ms) when the task was created."),
|
|
23
|
+
completed_at: z.number().nullable().describe("Timestamp (ms) when the task reached a terminal state. null if still running."),
|
|
24
|
+
project_id: z.string().nullable().describe("Project ID associated with this task, if any."),
|
|
25
|
+
}).strict();
|
|
26
|
+
export const QueryTaskStatusOutputSchema = z.object({
|
|
27
|
+
task_id: z.string().optional().describe("The queried task ID (present when a single task was queried)."),
|
|
28
|
+
task: TaskStateSchema.nullable().describe("The task state. null if task_id not found or when listing."),
|
|
29
|
+
tasks: z.array(TaskStateSchema).optional().describe("List of tasks (present when task_id was omitted)."),
|
|
30
|
+
}).strict();
|
|
31
|
+
export async function handleQueryTaskStatus(args) {
|
|
32
|
+
const validated = (args && typeof args === "object" ? args : {});
|
|
33
|
+
if (validated.task_id) {
|
|
34
|
+
const task = TaskTracker.get(validated.task_id);
|
|
35
|
+
const result = {
|
|
36
|
+
task_id: validated.task_id,
|
|
37
|
+
task: task ?? null,
|
|
38
|
+
tasks: undefined,
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
42
|
+
structuredContent: result,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const tasks = TaskTracker.list(validated.project_id).slice(0, 50);
|
|
46
|
+
const result = {
|
|
47
|
+
task_id: undefined,
|
|
48
|
+
task: null,
|
|
49
|
+
tasks,
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
content: [{ type: "text", text: JSON.stringify(result) }],
|
|
53
|
+
structuredContent: result,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -1,6 +1,36 @@
|
|
|
1
1
|
import { strictParse, WipOperationsSchema, } from "../../schema/index.js";
|
|
2
2
|
import { generate_wip, verify_wip, sign_wip, wip2html, } from "@wowok/wowok";
|
|
3
|
+
import { analyzeWipDeployment, formatDeployHints, } from "../wip-deploy-assist.js";
|
|
3
4
|
export async function handleWipOperations(args) {
|
|
5
|
+
if (typeof args === "object" && args !== null
|
|
6
|
+
&& args.type === "deploy_assist") {
|
|
7
|
+
const wipPath = args.wipFilePath;
|
|
8
|
+
if (typeof wipPath !== "string") {
|
|
9
|
+
return {
|
|
10
|
+
content: [{
|
|
11
|
+
type: "text",
|
|
12
|
+
text: "Error: 'wipFilePath' is required for deploy_assist action",
|
|
13
|
+
}],
|
|
14
|
+
structuredContent: {
|
|
15
|
+
result: {
|
|
16
|
+
type: "error",
|
|
17
|
+
error: "'wipFilePath' is required for deploy_assist action",
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const suggestion = analyzeWipDeployment(wipPath);
|
|
23
|
+
const hints = formatDeployHints(suggestion);
|
|
24
|
+
return {
|
|
25
|
+
content: [{ type: "text", text: hints || "No deployment needed." }],
|
|
26
|
+
structuredContent: {
|
|
27
|
+
result: {
|
|
28
|
+
type: "deploy_assist",
|
|
29
|
+
...suggestion,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
4
34
|
const validated = strictParse(WipOperationsSchema, args, "wip_file input");
|
|
5
35
|
let structuredContent;
|
|
6
36
|
switch (validated.type) {
|
|
@@ -10,8 +40,24 @@ export async function handleWipOperations(args) {
|
|
|
10
40
|
break;
|
|
11
41
|
}
|
|
12
42
|
case "verify": {
|
|
43
|
+
const deploySuggestion = analyzeWipDeployment(validated.wipFilePath);
|
|
13
44
|
const result = await verify_wip(validated.wipFilePath, validated.hash_equal, validated.requireSignature);
|
|
14
|
-
|
|
45
|
+
const attachHints = deploySuggestion.needs_deployment
|
|
46
|
+
|| (!result.valid && deploySuggestion.classification.type !== "data_url");
|
|
47
|
+
if (attachHints) {
|
|
48
|
+
const hints = formatDeployHints(deploySuggestion);
|
|
49
|
+
structuredContent = {
|
|
50
|
+
result: {
|
|
51
|
+
type: "verify",
|
|
52
|
+
...result,
|
|
53
|
+
deployment_assistance: deploySuggestion,
|
|
54
|
+
},
|
|
55
|
+
deployment_hints: hints,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
structuredContent = { result: { type: "verify", ...result } };
|
|
60
|
+
}
|
|
15
61
|
break;
|
|
16
62
|
}
|
|
17
63
|
case "sign": {
|