@wowok/agent-mcp 2.6.1 → 2.6.3
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/customer/info-puzzle.d.ts +1 -1
- package/dist/customer/info-puzzle.js +4 -2
- package/dist/customer/risk-assessment.js +26 -4
- package/dist/customer/types.d.ts +2 -0
- package/dist/examples/guard-template-balance-check.json +38 -0
- package/dist/examples/guard-template-time-lock.json +39 -0
- package/dist/examples/machine-template-7node-rental.json +114 -0
- package/dist/examples/rental-ziroom-machine-create.json +137 -0
- package/dist/examples/rental-ziroom-permission-create.json +35 -0
- package/dist/examples/rental-ziroom-service-create.json +80 -0
- package/dist/examples/retail-myshop-service-create.json +88 -0
- package/dist/extensions/capability-manifest.js +24 -24
- package/dist/extensions/constraint-registry.js +18 -18
- package/dist/extensions/metric-registry.js +14 -14
- package/dist/extensions/mode-evaluator.js +16 -16
- package/dist/extensions/modes.js +131 -45
- package/dist/extensions/registry.d.ts +2 -0
- package/dist/extensions/registry.js +63 -30
- package/dist/extensions/types.d.ts +1 -0
- package/dist/index.js +50 -0
- package/dist/knowledge/deployment-scanner.js +1 -1
- package/dist/knowledge/fund-layer.d.ts +72 -0
- package/dist/knowledge/fund-layer.js +420 -0
- package/dist/knowledge/guard-render.d.ts +57 -0
- package/dist/knowledge/guard-render.js +700 -0
- package/dist/knowledge/guard-submission-prompt.d.ts +31 -0
- package/dist/knowledge/guard-submission-prompt.js +171 -0
- package/dist/knowledge/machine-ledger.js +1 -1
- package/dist/knowledge/machine-render.d.ts +41 -0
- package/dist/knowledge/machine-render.js +565 -0
- package/dist/knowledge/machine-templates.js +4 -4
- package/dist/knowledge/reward-confirm.js +2 -2
- package/dist/knowledge/reward-puzzle.js +1 -1
- package/dist/knowledge/reward-risk.js +9 -9
- package/dist/knowledge/reward-templates.js +2 -2
- package/dist/knowledge/service-confirm.d.ts +1 -1
- package/dist/knowledge/service-confirm.js +3 -3
- package/dist/knowledge/service-context.js +1 -1
- package/dist/knowledge/service-ledger.js +1 -1
- package/dist/knowledge/service-risk.d.ts +1 -1
- package/dist/knowledge/service-risk.js +3 -3
- package/dist/knowledge/service-templates.js +2 -2
- package/dist/knowledge/service-translation.d.ts +1 -1
- package/dist/knowledge/service-translation.js +7 -7
- package/dist/project/deployment-bridge.js +6 -5
- package/dist/project/deployment-doc.js +5 -5
- package/dist/project/edit-planner.d.ts +123 -0
- package/dist/project/edit-planner.js +1371 -0
- package/dist/project/evaluation.js +314 -14
- package/dist/project/graph-builder.js +6 -1
- package/dist/project/handlers.d.ts +99 -2
- package/dist/project/handlers.js +358 -16
- package/dist/project/stage-gate.js +4 -4
- package/dist/schema/call/allocation.js +2 -2
- package/dist/schema/call/arbitration.js +19 -6
- package/dist/schema/call/contact.js +2 -2
- package/dist/schema/call/demand.js +2 -2
- package/dist/schema/call/guard.js +1 -1
- package/dist/schema/call/machine.d.ts +1975 -777
- package/dist/schema/call/machine.js +50 -4
- package/dist/schema/call/order.js +3 -6
- package/dist/schema/call/permission.js +2 -2
- package/dist/schema/call/repository.js +2 -2
- package/dist/schema/call/reward.js +3 -3
- package/dist/schema/call/semantic.js +7 -1
- package/dist/schema/call/service.d.ts +180 -8
- package/dist/schema/call/service.js +82 -27
- package/dist/schema/call/treasury.js +3 -3
- package/dist/schema/common/index.d.ts +2 -0
- package/dist/schema/common/index.js +46 -10
- package/dist/schema/local/index.js +5 -1
- package/dist/schema/operations.d.ts +755 -176
- package/dist/schema/operations.js +43 -7
- package/dist/schema/project/index.d.ts +969 -6
- package/dist/schema/project/index.js +268 -4
- package/dist/schema/query/index.d.ts +217 -0
- package/dist/schema/query/index.js +63 -33
- package/dist/schema/schema-query/index.d.ts +53 -3
- package/dist/schema/schema-query/index.js +17 -2
- package/dist/schema/utils/node-parser.js +13 -0
- package/dist/schema/utils/object-type-utils.d.ts +12 -0
- package/dist/schema/utils/object-type-utils.js +35 -0
- package/dist/schema/utils/permission-machine-check.d.ts +49 -0
- package/dist/schema/utils/permission-machine-check.js +121 -0
- package/dist/schema/utils/skills-recommendation.d.ts +2 -0
- package/dist/schema/utils/skills-recommendation.js +76 -0
- package/dist/schema-query/index.d.ts +14 -1
- package/dist/schema-query/index.js +104 -2
- package/dist/schemas/account_operation.schema.json +1 -1
- package/dist/schemas/index.json +1 -1
- package/dist/schemas/onchain_events.output.json +1 -1
- package/dist/schemas/onchain_operations.output.json +2820 -0
- package/dist/schemas/onchain_operations.schema.json +115 -53
- package/dist/schemas/onchain_operations_allocation.schema.json +5 -5
- package/dist/schemas/onchain_operations_arbitration.schema.json +9 -7
- package/dist/schemas/onchain_operations_contact.schema.json +3 -3
- package/dist/schemas/onchain_operations_demand.schema.json +3 -3
- package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -2
- package/dist/schemas/onchain_operations_guard.schema.json +1 -1
- package/dist/schemas/onchain_operations_machine.schema.json +4 -4
- package/dist/schemas/onchain_operations_order.schema.json +3 -3
- package/dist/schemas/onchain_operations_payment.schema.json +1 -1
- package/dist/schemas/onchain_operations_permission.schema.json +2 -2
- package/dist/schemas/onchain_operations_progress.schema.json +1 -1
- package/dist/schemas/onchain_operations_proof.schema.json +1 -1
- package/dist/schemas/onchain_operations_repository.schema.json +3 -3
- package/dist/schemas/onchain_operations_reward.schema.json +6 -6
- package/dist/schemas/onchain_operations_service.schema.json +77 -17
- package/dist/schemas/onchain_operations_treasury.schema.json +4 -4
- package/dist/schemas/onchain_table_data.output.json +1 -1
- package/dist/schemas/onchain_table_data.schema.json +10 -9
- package/dist/schemas/project_operation.output.json +1026 -7
- package/dist/schemas/project_operation.schema.json +46 -4
- package/dist/schemas/query_toolkit.output.json +15 -15
- package/dist/schemas/query_toolkit.schema.json +3 -3
- package/dist/schemas/schema_query.output.json +64 -1
- package/dist/schemas/schema_query.schema.json +3 -2
- package/dist/schemas/wowok_buildin_info.output.json +81 -8
- package/dist/schemas/wowok_buildin_info.schema.json +46 -2
- package/dist/tools/handlers/onchain.js +571 -6
- package/dist/tools/handlers/project.js +25 -2
- package/dist/tools/handlers/schema-query.js +24 -1
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +177 -6
- package/package.json +2 -2
|
@@ -2,6 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
const IndustryEnum = z.enum([
|
|
3
3
|
"general",
|
|
4
4
|
"retail",
|
|
5
|
+
"retail_d2c",
|
|
5
6
|
"service",
|
|
6
7
|
"rental",
|
|
7
8
|
"freelance",
|
|
@@ -70,11 +71,17 @@ export const ProjectOperationInputSchema = z
|
|
|
70
71
|
"delete_project",
|
|
71
72
|
"assemble_context",
|
|
72
73
|
"get_machine_graph",
|
|
74
|
+
"get_guard_graph",
|
|
73
75
|
"generate_deployment_doc",
|
|
74
76
|
"pre_evaluate_check",
|
|
75
77
|
"verify_deployment",
|
|
76
78
|
"clone_project_to_network",
|
|
77
79
|
"migrate_network",
|
|
80
|
+
"migrate_to_mainnet",
|
|
81
|
+
"plan_object_edit",
|
|
82
|
+
"apply_object_edit",
|
|
83
|
+
"patch_machine_nodes",
|
|
84
|
+
"patch_guard_tree",
|
|
78
85
|
])
|
|
79
86
|
.describe("Action to perform. Two categories:\n" +
|
|
80
87
|
"1. Project Entity + Evaluation (15, GLM6): list_projects, create_project, create_project_from_onchain, update_project, get_project_detail, add_object, remove_object, create_version, build_graph, get_graph, evaluate_project, save_evaluation, compare_projects, refresh_objects, get_object_diff. Projects are first-class entities with SQLite persistence, rigid project-object relationships, three-pathway graph construction, and a dual rule-based + LLM-assisted evaluation engine.\n" +
|
|
@@ -83,7 +90,10 @@ export const ProjectOperationInputSchema = z
|
|
|
83
90
|
project: z
|
|
84
91
|
.string()
|
|
85
92
|
.optional()
|
|
86
|
-
.describe("Project prefix (human-readable unique identifier).
|
|
93
|
+
.describe("Project prefix (human-readable unique identifier). " +
|
|
94
|
+
"For create_project: OPTIONAL — if omitted, auto-derived from project_name (e.g. 'Twitch Service' → 'twitch_service'). " +
|
|
95
|
+
"For other actions (build_graph, evaluate_project, etc.): used to identify the project. " +
|
|
96
|
+
"Takes precedence resolution: project_id > project (prefix)."),
|
|
87
97
|
version: z
|
|
88
98
|
.string()
|
|
89
99
|
.regex(/^v\d+$/)
|
|
@@ -128,7 +138,8 @@ export const ProjectOperationInputSchema = z
|
|
|
128
138
|
"(and not 'general'), the system auto-applies an industry blueprint " +
|
|
129
139
|
"with ~10 draft objects (Permission, Service, Machine, Guard, Treasury, " +
|
|
130
140
|
"Allocation, etc.) + graph edges, ready for deployment. " +
|
|
131
|
-
"Supported industries: 'general' (no template), 'retail', '
|
|
141
|
+
"Supported industries: 'general' (no template), 'retail', 'retail_d2c' " +
|
|
142
|
+
"(Direct-to-Consumer, e.g., Shopify — Allocation escrow + 2 Guards), 'service', " +
|
|
132
143
|
"'rental', 'freelance', 'education', 'travel', 'subscription', 'custom'. " +
|
|
133
144
|
"Each industry preset embeds risk constraints (e.g., 'freelance' does " +
|
|
134
145
|
"NOT require compensation_fund, while 'rental'/'travel' do). " +
|
|
@@ -269,7 +280,11 @@ export const ProjectOperationInputSchema = z
|
|
|
269
280
|
refresh_before_eval: z
|
|
270
281
|
.boolean()
|
|
271
282
|
.optional()
|
|
272
|
-
.describe("When true, evaluate_project refreshes object cache from chain before evaluating.
|
|
283
|
+
.describe("When true (DEFAULT), evaluate_project refreshes object cache from chain before evaluating. " +
|
|
284
|
+
"Set to false ONLY for read-only checks where staleness is acceptable (e.g., quick comparisons). " +
|
|
285
|
+
"BUG-P0-2 fix: previously defaulted to false, causing stale Machine node_count and other " +
|
|
286
|
+
"dynamic-field-derived fields to produce false findings (e.g., 'Machine has no nodes'). " +
|
|
287
|
+
"Now defaults to true — set refresh_before_eval=false explicitly to skip refresh."),
|
|
273
288
|
eval_score: z
|
|
274
289
|
.number()
|
|
275
290
|
.min(0)
|
|
@@ -320,6 +335,56 @@ export const ProjectOperationInputSchema = z
|
|
|
320
335
|
"'detailed': adds sale list, arbitration list, reward list. " +
|
|
321
336
|
"'full': complete fields including stock, price, wip_hash, all config. " +
|
|
322
337
|
"Use 'summary' for quick review; request 'detailed' or 'full' only when deeper inspection is needed."),
|
|
338
|
+
object_kind: z
|
|
339
|
+
.enum(["machine", "guard"])
|
|
340
|
+
.optional()
|
|
341
|
+
.describe("Object kind for plan_object_edit. 'machine' = Machine workflow directed graph (cycles allowed), 'guard' = Guard computation tree. " +
|
|
342
|
+
"Required when action='plan_object_edit'. Inferred from action for patch_machine_nodes (always 'machine') " +
|
|
343
|
+
"and patch_guard_tree (always 'guard')."),
|
|
344
|
+
edit_format: z
|
|
345
|
+
.enum(["tree_outline", "json"])
|
|
346
|
+
.optional()
|
|
347
|
+
.describe("Format of the edited content for plan_object_edit. " +
|
|
348
|
+
"'tree_outline' (default): the indented Markdown outline produced by get_machine_graph / get_guard_graph (human-editable). " +
|
|
349
|
+
"'json': raw JSON (machine-readable, for programmatic edits). " +
|
|
350
|
+
"Both formats are bidirectional with the parse functions in knowledge/machine-render.ts / guard-render.ts."),
|
|
351
|
+
edited_content: z
|
|
352
|
+
.string()
|
|
353
|
+
.optional()
|
|
354
|
+
.describe("Edited content for plan_object_edit. Must be in the format specified by edit_format. " +
|
|
355
|
+
"For 'tree_outline': the full tree_outline string from get_machine_graph/get_guard_graph with user edits. " +
|
|
356
|
+
"For 'json': a JSON string matching the Machine/Guard schema. " +
|
|
357
|
+
"The content is parsed + validated + diffed against the current on-chain state."),
|
|
358
|
+
plan_id: z
|
|
359
|
+
.string()
|
|
360
|
+
.optional()
|
|
361
|
+
.describe("Plan ID returned by plan_object_edit. Required for apply_object_edit. " +
|
|
362
|
+
"The plan is short-lived (10-minute TTL) and stored in-memory."),
|
|
363
|
+
expected_hash: z
|
|
364
|
+
.string()
|
|
365
|
+
.optional()
|
|
366
|
+
.describe("Expected hash returned by plan_object_edit. Required for apply_object_edit. " +
|
|
367
|
+
"Used for optimistic concurrency control: if the on-chain state changed between plan and apply, " +
|
|
368
|
+
"the hash will mismatch and apply will refuse to proceed (stale edit protection)."),
|
|
369
|
+
patch_operations: z
|
|
370
|
+
.array(z.string())
|
|
371
|
+
.optional()
|
|
372
|
+
.describe("Patch operations for patch_machine_nodes / patch_guard_tree. Each string is a single patch operation.\n" +
|
|
373
|
+
"Machine operations (13 total):\n" +
|
|
374
|
+
" 'add node <name>' | 'remove node <name>' | 'set description <node_name> <text...>'\n" +
|
|
375
|
+
" 'add edge <from> <to>' | 'remove edge <from> <to>' | 'set threshold <edge_from> <edge_to> <value>'\n" +
|
|
376
|
+
" 'add forward <edge_from> <edge_to> <forward_name>' | 'remove forward <edge_from> <edge_to> <forward_name>'\n" +
|
|
377
|
+
" 'set guard <edge_from> <edge_to> <forward_name> <guard_addr_or_name|none>'\n" +
|
|
378
|
+
" 'set permission <edge_from> <edge_to> <forward_name> <perm_index>'\n" +
|
|
379
|
+
" 'set operator <edge_from> <edge_to> <forward_name> <named_operator|none>'\n" +
|
|
380
|
+
" 'set weight <edge_from> <edge_to> <forward_name> <weight>'\n" +
|
|
381
|
+
" 'set retained_submission <edge_from> <edge_to> <forward_name> <comma_separated_indices|none>'\n" +
|
|
382
|
+
"Guard operations (8 total — see patch_guard_tree):\n" +
|
|
383
|
+
" 'add table <identifier> <name|none> <value_type> <b_submission> [json_value]'\n" +
|
|
384
|
+
" 'remove table <identifier>' | 'set table_value <identifier> [json_value|none]'\n" +
|
|
385
|
+
" 'set table_name <identifier> <name|none>' | 'set table_submission <identifier> <true|false>'\n" +
|
|
386
|
+
" 'set root <json_node>' | 'set rely <comma_separated_guard_addresses|none>'\n" +
|
|
387
|
+
"Operations are applied in order. Both patches are validated (validateMachine/validateGuard) before execution."),
|
|
323
388
|
})
|
|
324
389
|
.strict();
|
|
325
390
|
const AssembleContextResultSchema = z
|
|
@@ -695,7 +760,7 @@ const GenerateDeploymentDocResultSchema = z
|
|
|
695
760
|
status: z.enum(["PASS", "WARN", "FAIL"]).describe("Check result status."),
|
|
696
761
|
message: z.string().describe("Human-readable check result message."),
|
|
697
762
|
}).strict()).describe("Per-dimension check results."),
|
|
698
|
-
}).strict().describe("Stage gate validation (GLM6 5-stage lifecycle
|
|
763
|
+
}).strict().describe("Stage gate validation (GLM6 5-stage lifecycle handoff). Validates Stage 3 risk score threshold (>=80 PASS, >=50 WARN, <50 FAIL) and Stage 4 deployment doc generation prerequisite."),
|
|
699
764
|
deployment_scan: z.object({
|
|
700
765
|
overall_readiness: z.enum(["ready", "blocked", "warnings"]).describe("'ready' = all 20 checks pass; 'blocked' = any critical fail; 'warnings' = only warning fails."),
|
|
701
766
|
critical_count: z.number().describe("Number of critical findings (blocks deployment)."),
|
|
@@ -817,6 +882,158 @@ const GetMachineGraphResultSchema = z
|
|
|
817
882
|
edges: z.array(MachineGraphEdgeSchema).describe("Directed edges (pairs) connecting nodes. Each edge has a threshold and forwards."),
|
|
818
883
|
published: z.boolean().nullable().describe("Whether the Machine is published (locked for production). null = unknown."),
|
|
819
884
|
paused: z.boolean().nullable().describe("Whether the Machine is paused (not generating new Progress). null = unknown."),
|
|
885
|
+
mermaid: z.string().describe("Mermaid stateDiagram-v2 string visualizing the directed graph. Entry nodes start from [*]. Edge labels include forward name + threshold + guard info. Cycles (revision loops) are rendered as normal edges. Includes a color legend comment block + BehaviorTree.CPP-style color annotations (entry=green, terminal=red, revision=amber, normal=blue). Renderable in markdown viewers."),
|
|
886
|
+
tree_outline: z.string().describe("Indented Markdown outline of the directed graph (human-editable format). Lists edges as outline entries with forwards nested under each edge. Includes a Backrefs section consolidating incoming edges per node (editing aid — answers 'who transitions INTO node X?'). Bidirectional with parseMachineTreeIndented(). Includes JSON code block for round-trip safety. Use this for the download -> edit -> republish workflow."),
|
|
887
|
+
ascii_art: z.string().describe("ASCII art directed graph visualization using arrow notation (A -forward-> B). Cycle (revision loop) and terminal annotations included. Terminal-friendly, avoids JSON escaping issues that affect multi-line Mermaid strings. Use when rendering in plain-text contexts."),
|
|
888
|
+
markmap: z.string().describe("Markmap-compatible Markdown string (heading levels represent hierarchy). Edge-centric layout with forwards nested under edges. Renderable by VS Code Markmap extension or markmap.js. Provides an interactive mind-map view of the workflow."),
|
|
889
|
+
})
|
|
890
|
+
.strict();
|
|
891
|
+
const GuardGraphNodeSchema = z.lazy(() => z.object({
|
|
892
|
+
type: z.string().describe("Guard node type (logic_and, query, identifier, context, calc_*, convert_*, vec_*, etc.)."),
|
|
893
|
+
nodes: z.array(GuardGraphNodeSchema).optional().describe("Child nodes (for logic_and/or, calc_*, vec_contains_*, etc.)."),
|
|
894
|
+
node: GuardGraphNodeSchema.optional().describe("Single child (for logic_not, convert_*, value_type)."),
|
|
895
|
+
nodeLeft: GuardGraphNodeSchema.optional().describe("Left child (for vec_indexof_*)."),
|
|
896
|
+
nodeRight: GuardGraphNodeSchema.optional().describe("Right child (for vec_indexof_*)."),
|
|
897
|
+
query: z.union([z.number(), z.string()]).optional().describe("Query instruction ID or name (for query nodes)."),
|
|
898
|
+
object: z.object({
|
|
899
|
+
identifier: z.number().optional(),
|
|
900
|
+
convert_witness: z.number().optional(),
|
|
901
|
+
}).optional().describe("Query target object reference."),
|
|
902
|
+
parameters: z.array(GuardGraphNodeSchema).optional().describe("Query parameters."),
|
|
903
|
+
identifier: z.number().optional().describe("Table entry index (for identifier nodes)."),
|
|
904
|
+
context: z.string().optional().describe("Context type: Signer, Clock, or Guard."),
|
|
905
|
+
}).strict());
|
|
906
|
+
const GuardTableEntrySchema = z.object({
|
|
907
|
+
identifier: z.number().describe("Table entry index (0-255)."),
|
|
908
|
+
b_submission: z.boolean().describe("Whether this entry is submitted at runtime."),
|
|
909
|
+
value_type: z.union([z.number(), z.string()]).describe("Value type (numeric code or name)."),
|
|
910
|
+
value: z.unknown().optional().describe("Constant value (if b_submission=false)."),
|
|
911
|
+
name: z.string().optional().describe("Human-readable name/description."),
|
|
912
|
+
}).strict();
|
|
913
|
+
const GetGuardGraphResultSchema = z
|
|
914
|
+
.object({
|
|
915
|
+
action: z.literal("get_guard_graph"),
|
|
916
|
+
guardAddress: z.string().describe("The Guard object address."),
|
|
917
|
+
guardName: z.string().nullable().describe("The Guard's local name (from LocalMark) if available."),
|
|
918
|
+
root: GuardGraphNodeSchema.describe("Root computation node (returns Bool). The tree is recursive — each node may have children."),
|
|
919
|
+
table: z.array(GuardTableEntrySchema).describe("Guard data table entries (constants + submission slots)."),
|
|
920
|
+
rely: z.object({
|
|
921
|
+
guards: z.array(z.string()),
|
|
922
|
+
logic_or: z.boolean().optional(),
|
|
923
|
+
}).nullable().describe("Rely dependencies (other Guards this Guard depends on). null = no rely."),
|
|
924
|
+
immutable: z.boolean().nullable().describe("Whether the Guard is immutable (frozen for verification). null = unknown."),
|
|
925
|
+
mermaid: z.string().describe("Mermaid flowchart TD string visualizing the tree. Node shapes: {}=decision (logic_*), []=computation/query, ([])=leaf (identifier), {{}}=context. Includes a color legend comment block + BehaviorTree.CPP-style color annotations (control=blue, decision=amber, computation=purple, query=cyan, leaf=gray, context=green)."),
|
|
926
|
+
tree_outline: z.string().describe("Indented Markdown outline of the tree (human-editable format). Bidirectional with parseGuardTreeIndented(). Includes JSON code block for round-trip safety."),
|
|
927
|
+
ascii_art: z.string().describe("ASCII art tree visualization using box-drawing characters (+-- --, |). Table summary appended. Terminal-friendly, avoids JSON escaping issues that affect multi-line Mermaid strings."),
|
|
928
|
+
markmap: z.string().describe("Markmap-compatible Markdown string (heading levels represent tree depth). Root -> branches -> leaves hierarchy. Renderable by VS Code Markmap extension or markmap.js. Provides an interactive mind-map view of the Guard tree."),
|
|
929
|
+
})
|
|
930
|
+
.strict();
|
|
931
|
+
const PlanObjectEditResultSchema = z
|
|
932
|
+
.object({
|
|
933
|
+
action: z.literal("plan_object_edit"),
|
|
934
|
+
plan_id: z.string().describe("Unique plan ID (UUID). Pass to apply_object_edit within 10 minutes to execute."),
|
|
935
|
+
object_kind: z.enum(["machine", "guard"]).describe("The object kind that was edited."),
|
|
936
|
+
object_address: z.string().describe("The on-chain object address being edited."),
|
|
937
|
+
object_name: z.string().nullable().describe("The object's local name (from LocalMark) if available."),
|
|
938
|
+
expected_hash: z.string().describe("SHA-256 hash of (current_onchain_state + edited_content). Pass to apply_object_edit as expected_hash for stale-edit detection."),
|
|
939
|
+
diff: z.object({
|
|
940
|
+
added: z.array(z.string()).describe("List of added items (node names, edge 'from->to', table identifiers, etc.)."),
|
|
941
|
+
removed: z.array(z.string()).describe("List of removed items."),
|
|
942
|
+
modified: z.array(z.string()).describe("List of modified items with a brief description of the change."),
|
|
943
|
+
summary: z.string().describe("Human-readable one-line diff summary (e.g. '2 nodes added, 1 edge removed, 3 forwards modified')."),
|
|
944
|
+
}).describe("Structured diff between current on-chain state and edited content."),
|
|
945
|
+
warnings: z.array(z.object({
|
|
946
|
+
id: z.string().describe("Warning identifier (e.g. 'W-01')."),
|
|
947
|
+
description: z.string().describe("What the warning is about."),
|
|
948
|
+
impact: z.string().describe("Potential impact if ignored."),
|
|
949
|
+
})).describe("Non-blocking warnings (the edit can still proceed, but review is recommended)."),
|
|
950
|
+
blocking_errors: z.array(z.object({
|
|
951
|
+
id: z.string().describe("Error identifier (e.g. 'E-01')."),
|
|
952
|
+
description: z.string().describe("What the error is."),
|
|
953
|
+
impact: z.string().describe("Why this blocks execution."),
|
|
954
|
+
})).describe("Blocking errors (the edit CANNOT proceed until these are fixed)."),
|
|
955
|
+
can_apply: z.boolean().describe("Whether apply_object_edit can proceed. false if blocking_errors is non-empty."),
|
|
956
|
+
prepared_call: z.unknown().nullable().describe("The prepared onchain_operations call data (operation_type + data). null if can_apply=false. Pass this to onchain_operations to execute the edit."),
|
|
957
|
+
expires_at: z.string().describe("ISO timestamp when the plan expires (10 minutes from creation). After expiry, apply_object_edit will refuse to proceed."),
|
|
958
|
+
summary: z.string().describe("Human-readable one-line plan summary."),
|
|
959
|
+
})
|
|
960
|
+
.strict();
|
|
961
|
+
const ApplyObjectEditResultSchema = z
|
|
962
|
+
.object({
|
|
963
|
+
action: z.literal("apply_object_edit"),
|
|
964
|
+
plan_id: z.string().describe("The plan ID that was applied."),
|
|
965
|
+
applied: z.boolean().describe("Whether the plan was successfully applied (hash matched and plan was fresh)."),
|
|
966
|
+
hash_match: z.boolean().describe("Whether the expected_hash matched the stored plan hash. false = stale edit detected."),
|
|
967
|
+
prepared_call: z.unknown().nullable().describe("The prepared onchain_operations call data. Pass this to onchain_operations to execute the edit on-chain. null if applied=false."),
|
|
968
|
+
error: z.string().nullable().describe("Error message if applied=false (e.g. 'Plan not found', 'Hash mismatch — on-chain state changed', 'Plan expired'). null on success."),
|
|
969
|
+
next_step: z.string().describe("Instructions for the next step (typically 'Pass prepared_call to onchain_operations to execute the edit on-chain')."),
|
|
970
|
+
})
|
|
971
|
+
.strict();
|
|
972
|
+
const PatchMachineNodesResultSchema = z
|
|
973
|
+
.object({
|
|
974
|
+
action: z.literal("patch_machine_nodes"),
|
|
975
|
+
machine_address: z.string().describe("The Machine object address being patched."),
|
|
976
|
+
machine_name: z.string().nullable().describe("The Machine's local name (from LocalMark) if available."),
|
|
977
|
+
operations_applied: z.number().describe("Number of patch operations successfully applied."),
|
|
978
|
+
operations_failed: z.array(z.object({
|
|
979
|
+
operation: z.string().describe("The original operation string."),
|
|
980
|
+
error: z.string().describe("Why the operation failed."),
|
|
981
|
+
})).describe("Operations that failed parse/apply (not applied). Also surfaced as E-OP entries in blocking_errors for schema symmetry with plan_object_edit."),
|
|
982
|
+
patched_nodes: z.array(z.unknown()).describe("The patched Machine nodes (after applying all successful operations)."),
|
|
983
|
+
patched_edges: z.array(z.unknown()).describe("The patched Machine edges (after applying all successful operations)."),
|
|
984
|
+
diff: z.object({
|
|
985
|
+
added: z.array(z.string()).describe("List of added items."),
|
|
986
|
+
removed: z.array(z.string()).describe("List of removed items."),
|
|
987
|
+
modified: z.array(z.string()).describe("List of modified items."),
|
|
988
|
+
summary: z.string().describe("Human-readable one-line diff summary."),
|
|
989
|
+
}).describe("Diff between original and patched Machine."),
|
|
990
|
+
warnings: z.array(z.object({
|
|
991
|
+
id: z.string().describe("Warning identifier (e.g. 'W-01' unreachable node, 'W-02' self-loop)."),
|
|
992
|
+
description: z.string().describe("What the warning is about."),
|
|
993
|
+
impact: z.string().describe("Potential impact if ignored."),
|
|
994
|
+
})).describe("Non-blocking warnings from validateMachine (W-01 unreachable, W-02 self-loop)."),
|
|
995
|
+
blocking_errors: z.array(z.object({
|
|
996
|
+
id: z.string().describe("Error identifier (e.g. 'E-01' no entry forward, 'E-02' orphan endpoint, 'E-03' too many nodes, 'E-OP' operation failed)."),
|
|
997
|
+
description: z.string().describe("What the error is."),
|
|
998
|
+
impact: z.string().describe("Why this blocks execution."),
|
|
999
|
+
})).describe("Blocking errors (operation failures + structural validation). The patch CANNOT proceed until these are fixed. Empty array when can_apply=true."),
|
|
1000
|
+
can_apply: z.boolean().describe("Whether the patch can be applied on-chain. false if any blocking_errors exist (operation failures or validateMachine blocking errors)."),
|
|
1001
|
+
prepared_call: z.unknown().nullable().describe("The prepared onchain_operations call data. null if can_apply=false."),
|
|
1002
|
+
summary: z.string().describe("Human-readable one-line patch summary."),
|
|
1003
|
+
})
|
|
1004
|
+
.strict();
|
|
1005
|
+
const PatchGuardTreeResultSchema = z
|
|
1006
|
+
.object({
|
|
1007
|
+
action: z.literal("patch_guard_tree"),
|
|
1008
|
+
guard_address: z.string().describe("The Guard object address being patched."),
|
|
1009
|
+
guard_name: z.string().nullable().describe("The Guard's local name (from LocalMark) if available."),
|
|
1010
|
+
operations_applied: z.number().describe("Number of Guard patch operations successfully applied."),
|
|
1011
|
+
operations_failed: z.array(z.object({
|
|
1012
|
+
operation: z.string().describe("The original operation string."),
|
|
1013
|
+
error: z.string().describe("Why the operation failed."),
|
|
1014
|
+
})).describe("Operations that failed parse/apply (not applied). Also surfaced as E-OP entries in blocking_errors."),
|
|
1015
|
+
patched_root: z.unknown().describe("The patched Guard root node (after applying all successful operations). For set_root, this is the new root; otherwise the original root unchanged."),
|
|
1016
|
+
patched_table: z.array(z.unknown()).describe("The patched Guard table entries (after applying all successful table operations)."),
|
|
1017
|
+
patched_rely: z.unknown().nullable().describe("The patched rely field (cross-guard composition). null if rely was cleared or never set. Shape: { guards: string[], logic_or?: boolean }."),
|
|
1018
|
+
diff: z.object({
|
|
1019
|
+
added: z.array(z.string()).describe("List of added items (table entries, tree nodes)."),
|
|
1020
|
+
removed: z.array(z.string()).describe("List of removed items."),
|
|
1021
|
+
modified: z.array(z.string()).describe("List of modified items with a brief description of the change."),
|
|
1022
|
+
summary: z.string().describe("Human-readable one-line diff summary."),
|
|
1023
|
+
}).describe("Diff between original and patched Guard (root tree + table)."),
|
|
1024
|
+
warnings: z.array(z.object({
|
|
1025
|
+
id: z.string().describe("Warning identifier (e.g. 'W-01' dead submission slot, 'W-02' orphan table entry, 'W-03' deep nesting)."),
|
|
1026
|
+
description: z.string().describe("What the warning is about."),
|
|
1027
|
+
impact: z.string().describe("Potential impact if ignored."),
|
|
1028
|
+
})).describe("Non-blocking warnings from validateGuard (W-01 dead submission slot, W-02 orphan table entry, W-03 deep nesting > 16)."),
|
|
1029
|
+
blocking_errors: z.array(z.object({
|
|
1030
|
+
id: z.string().describe("Error identifier (e.g. 'E-01' no root, 'E-02' identifier not in table, 'E-03' table too large, 'E-OP' operation failed)."),
|
|
1031
|
+
description: z.string().describe("What the error is."),
|
|
1032
|
+
impact: z.string().describe("Why this blocks execution."),
|
|
1033
|
+
})).describe("Blocking errors (operation failures + structural validation). The patch CANNOT proceed until these are fixed. Empty array when can_apply=true."),
|
|
1034
|
+
can_apply: z.boolean().describe("Whether the patch can be applied on-chain. false if any blocking_errors exist."),
|
|
1035
|
+
prepared_call: z.unknown().nullable().describe("The prepared onchain_operations call data (operation_type='guard'). null if can_apply=false."),
|
|
1036
|
+
summary: z.string().describe("Human-readable one-line patch summary."),
|
|
820
1037
|
})
|
|
821
1038
|
.strict();
|
|
822
1039
|
const CloneProjectToNetworkResultSchema = z
|
|
@@ -841,6 +1058,43 @@ const MigrateNetworkResultSchema = z
|
|
|
841
1058
|
next_steps: z.string().describe("Instructions for deploying the migrated objects on the target network."),
|
|
842
1059
|
})
|
|
843
1060
|
.strict();
|
|
1061
|
+
const MigrationPlanStepSchema = z.object({
|
|
1062
|
+
step: z.number().describe("Step number (1-5)."),
|
|
1063
|
+
status: z.enum(["completed", "pending_user_action"]).describe("Whether this step is done or awaits user action."),
|
|
1064
|
+
action: z.string().describe("The action to perform (e.g. 'clone_project_to_network', 'onchain_operations', 'local_mark_operation', 'update_project', 'build_graph')."),
|
|
1065
|
+
description: z.string().describe("Human-readable description of what this step does."),
|
|
1066
|
+
result: z.string().optional().describe("Result of this step (only present when status='completed')."),
|
|
1067
|
+
deployment_plan: z.array(z.object({
|
|
1068
|
+
order: z.number(),
|
|
1069
|
+
object_type: z.string(),
|
|
1070
|
+
object_name: z.string(),
|
|
1071
|
+
operation_type: z.string(),
|
|
1072
|
+
localmark_name: z.string(),
|
|
1073
|
+
note: z.string(),
|
|
1074
|
+
})).optional().describe("Deployment plan for step 2 (on-chain deployment). Only present for step 2."),
|
|
1075
|
+
names_to_register: z.array(z.string()).optional().describe("LocalMark names to re-register on mainnet. Only present for step 3."),
|
|
1076
|
+
critical_note: z.string().optional().describe("Critical note for this step."),
|
|
1077
|
+
}).strict();
|
|
1078
|
+
const MigrateToMainnetResultSchema = z
|
|
1079
|
+
.object({
|
|
1080
|
+
action: z.literal("migrate_to_mainnet"),
|
|
1081
|
+
migration_status: z.string().describe("Overall migration status (e.g. 'step_1_complete_steps_2_5_pending_user_action')."),
|
|
1082
|
+
source_project: z.object({
|
|
1083
|
+
prefix: z.string(),
|
|
1084
|
+
network: z.string(),
|
|
1085
|
+
preserved: z.boolean().describe("Whether the source project is preserved unchanged (always true)."),
|
|
1086
|
+
}).strict(),
|
|
1087
|
+
target_project: z.object({
|
|
1088
|
+
prefix: z.string(),
|
|
1089
|
+
project_id: z.string(),
|
|
1090
|
+
network: z.string(),
|
|
1091
|
+
cloned_objects_count: z.number(),
|
|
1092
|
+
}).strict(),
|
|
1093
|
+
key_principle: z.string().describe("Explains that testnet/mainnet are different projects with different addresses for same names."),
|
|
1094
|
+
migration_plan: z.array(MigrationPlanStepSchema).describe("5-step migration plan. Step 1 is completed; steps 2-5 require user action."),
|
|
1095
|
+
summary: z.string().describe("Human-readable summary of the migration."),
|
|
1096
|
+
})
|
|
1097
|
+
.strict();
|
|
844
1098
|
export const ProjectOperationOutputSchema = z
|
|
845
1099
|
.object({
|
|
846
1100
|
result: z.discriminatedUnion("action", [
|
|
@@ -866,8 +1120,18 @@ export const ProjectOperationOutputSchema = z
|
|
|
866
1120
|
PreEvaluateCheckResultSchema,
|
|
867
1121
|
VerifyDeploymentResultSchema,
|
|
868
1122
|
GetMachineGraphResultSchema,
|
|
1123
|
+
GetGuardGraphResultSchema,
|
|
1124
|
+
PlanObjectEditResultSchema,
|
|
1125
|
+
ApplyObjectEditResultSchema,
|
|
1126
|
+
PatchMachineNodesResultSchema,
|
|
1127
|
+
PatchGuardTreeResultSchema,
|
|
869
1128
|
CloneProjectToNetworkResultSchema,
|
|
870
1129
|
MigrateNetworkResultSchema,
|
|
1130
|
+
MigrateToMainnetResultSchema,
|
|
871
1131
|
]).describe("Query result — shape depends on action"),
|
|
1132
|
+
skills_recommended: z.string().optional().describe("Skills recommendation hint (F-10). Informational only — MCP executes " +
|
|
1133
|
+
"independently of skills. Present when the action benefits from skills' " +
|
|
1134
|
+
"business-semantic guidance (e.g. service/machine/guard/evaluation). " +
|
|
1135
|
+
"Users without skills installed can ignore this field."),
|
|
872
1136
|
})
|
|
873
1137
|
.strict();
|