@wowok/agent-mcp 2.5.4 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -26
- package/dist/config/runtime.js +3 -6
- package/dist/harness/checkpoint.js +2 -2
- package/dist/knowledge/flywheel-loop.js +2 -5
- 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/reward-confirm.d.ts +3 -0
- package/dist/knowledge/reward-confirm.js +30 -0
- package/dist/knowledge/reward-puzzle.d.ts +1 -0
- package/dist/knowledge/reward-puzzle.js +12 -0
- package/dist/knowledge/reward-risk.d.ts +4 -1
- package/dist/knowledge/reward-risk.js +85 -3
- package/dist/knowledge/tools-reference.js +5 -4
- package/dist/loop-engineering/improve.js +2 -4
- package/dist/project/deployment-bridge.d.ts +5 -0
- package/dist/project/deployment-bridge.js +96 -0
- package/dist/project/evaluation.d.ts +53 -0
- package/dist/project/evaluation.js +860 -0
- package/dist/project/graph-builder.d.ts +43 -0
- package/dist/project/graph-builder.js +585 -0
- package/dist/project/handlers.d.ts +154 -0
- package/dist/project/handlers.js +567 -0
- package/dist/project/index.d.ts +1 -0
- package/dist/project/index.js +26 -7
- package/dist/project/project-store.js +2 -5
- package/dist/project/query.d.ts +1 -0
- package/dist/project/query.js +2 -0
- package/dist/project/semantic-assembler.d.ts +93 -0
- package/dist/project/semantic-assembler.js +345 -0
- package/dist/schema/call/base.js +1 -1
- package/dist/schema/config/index.d.ts +12 -12
- package/dist/schema/local/index.d.ts +108 -108
- package/dist/schema/local/index.js +21 -18
- package/dist/schema/messenger/index.d.ts +16 -16
- package/dist/schema/messenger/index.js +2 -2
- package/dist/schema/operations.d.ts +0 -6
- package/dist/schema/project/index.d.ts +1840 -3903
- package/dist/schema/project/index.js +403 -955
- package/dist/schema/query/index.d.ts +10 -5
- package/dist/schema/trust/index.d.ts +6 -6
- package/dist/schemas/account_operation.output.json +7 -21
- package/dist/schemas/account_operation.schema.json +9 -23
- package/dist/schemas/bridge_operation.schema.json +1 -1
- package/dist/schemas/guard2file.schema.json +1 -1
- package/dist/schemas/index.json +2 -2
- package/dist/schemas/machineNode2file.schema.json +1 -1
- package/dist/schemas/messenger_operation.schema.json +6 -6
- package/dist/schemas/onchain_operations.schema.json +5 -5
- package/dist/schemas/onchain_operations_allocation.schema.json +1 -1
- package/dist/schemas/onchain_operations_arbitration.schema.json +1 -1
- package/dist/schemas/onchain_operations_contact.schema.json +1 -1
- package/dist/schemas/onchain_operations_demand.schema.json +1 -1
- package/dist/schemas/onchain_operations_gen_passport.schema.json +2 -2
- 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 +1 -1
- package/dist/schemas/onchain_operations_order.schema.json +1 -1
- package/dist/schemas/onchain_operations_payment.schema.json +1 -1
- package/dist/schemas/onchain_operations_permission.schema.json +1 -1
- package/dist/schemas/onchain_operations_personal.schema.json +1 -1
- 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 +1 -1
- package/dist/schemas/onchain_operations_reward.schema.json +1 -1
- package/dist/schemas/onchain_operations_service.schema.json +1 -1
- package/dist/schemas/onchain_operations_treasury.schema.json +1 -1
- package/dist/schemas/project_operation.output.json +1178 -2494
- package/dist/schemas/project_operation.schema.json +216 -530
- package/dist/schemas/query_toolkit.output.json +7 -6
- package/dist/schemas/query_toolkit.schema.json +0 -4
- package/dist/telemetry/storage.js +2 -2
- package/dist/tools/handlers/onchain.js +110 -19
- package/dist/tools/handlers/project.js +56 -1046
- package/dist/tools/index.js +85 -56
- package/package.json +2 -2
|
@@ -47,1089 +47,537 @@ export const EdgeKindEnum = z.enum([
|
|
|
47
47
|
"sub_order",
|
|
48
48
|
"references",
|
|
49
49
|
]);
|
|
50
|
-
const PuzzleEntrySchema = z
|
|
51
|
-
.object({
|
|
52
|
-
puzzle: z
|
|
53
|
-
.record(z.unknown())
|
|
54
|
-
.describe("Per-object puzzle snapshot. Shape varies per object_type — see knowledge/<obj>-puzzle.ts."),
|
|
55
|
-
completeness: z
|
|
56
|
-
.record(z.unknown())
|
|
57
|
-
.describe("Completeness assessment from checkPuzzleCompleteness(). Shape varies per object."),
|
|
58
|
-
missing_dimensions: z
|
|
59
|
-
.array(z.string())
|
|
60
|
-
.describe("Dimensions still missing for this object (e.g. ['A','B'])."),
|
|
61
|
-
})
|
|
62
|
-
.strict();
|
|
63
50
|
export const ProjectOperationInputSchema = z
|
|
64
51
|
.object({
|
|
65
52
|
action: z
|
|
66
53
|
.enum([
|
|
67
54
|
"list_projects",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"export_project",
|
|
85
|
-
"get_project_files",
|
|
86
|
-
"validate_stage_unit",
|
|
87
|
-
"get_stage_assessment",
|
|
88
|
-
"get_stage_risk_policy",
|
|
89
|
-
"get_doc_relations",
|
|
90
|
-
"update_deployment_doc",
|
|
91
|
-
"validate_validation_chain",
|
|
92
|
-
"apply_improvement",
|
|
93
|
-
"get_improvement_queue",
|
|
94
|
-
"get_flywheel_config",
|
|
95
|
-
"rollback_stage",
|
|
96
|
-
"get_reversibility",
|
|
55
|
+
"create_project",
|
|
56
|
+
"create_project_from_onchain",
|
|
57
|
+
"update_project",
|
|
58
|
+
"get_project_detail",
|
|
59
|
+
"add_object",
|
|
60
|
+
"remove_object",
|
|
61
|
+
"update_object",
|
|
62
|
+
"create_version",
|
|
63
|
+
"build_graph",
|
|
64
|
+
"get_graph",
|
|
65
|
+
"evaluate_project",
|
|
66
|
+
"save_evaluation",
|
|
67
|
+
"compare_projects",
|
|
68
|
+
"refresh_objects",
|
|
69
|
+
"get_object_diff",
|
|
70
|
+
"delete_project",
|
|
97
71
|
"assemble_context",
|
|
72
|
+
"generate_deployment_doc",
|
|
98
73
|
])
|
|
99
|
-
.describe("Action to perform.
|
|
100
|
-
"1.
|
|
101
|
-
"2.
|
|
102
|
-
"3. Project Memory Layer (5): load_project, fork_project, export_project, get_project_files, get_project_status.\n" +
|
|
103
|
-
"4. Nested-Autonomy Stage Unit (6): validate_stage_unit, get_stage_assessment, get_stage_risk_policy, get_doc_relations, update_deployment_doc, validate_validation_chain.\n" +
|
|
104
|
-
"5. Distillation Reflow (3): apply_improvement (review + apply a proposal — config_override writes overrides/, source_patch writes patches/), get_improvement_queue (list pending/approved proposals), get_flywheel_config (query reflow loop status).\n" +
|
|
105
|
-
"6. Rollback & Reversibility (2): rollback_stage (evaluate + execute stage rollback with file cleanup — blocked if has_published_object), get_reversibility (query object lifecycle reversibility matrix for risk reminders).\n" +
|
|
106
|
-
"7. Context Assembly (1): assemble_context (query on-chain object states + extract embedded history + optional events, and assemble a structured semantic context for LLM consumption — bridges raw facts to business-understandable context). Required input: context_objects (array of object IDs/names). Optional: include_events (query recent state-transition events)."),
|
|
74
|
+
.describe("Action to perform. Two categories:\n" +
|
|
75
|
+
"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" +
|
|
76
|
+
"2. Context Assembly (1): assemble_context (query on-chain object states + extract embedded history + optional events, and assemble a structured semantic context for LLM consumption). Required input: context_objects (array of object IDs/names). Optional: include_events (query recent state-transition events)."),
|
|
107
77
|
project: z
|
|
108
78
|
.string()
|
|
109
79
|
.optional()
|
|
110
|
-
.describe("Project prefix (
|
|
80
|
+
.describe("Project prefix (human-readable unique identifier). Used by create_version, build_graph, evaluate_project, etc. Takes precedence resolution: project_id > project (prefix)."),
|
|
111
81
|
version: z
|
|
112
82
|
.string()
|
|
113
83
|
.regex(/^v\d+$/)
|
|
114
84
|
.optional()
|
|
115
|
-
.describe("Project version (e.g. 'v1').
|
|
116
|
-
|
|
117
|
-
.string()
|
|
85
|
+
.describe("Project version (e.g. 'v1'). Used by create_version."),
|
|
86
|
+
context_objects: z
|
|
87
|
+
.array(z.string())
|
|
118
88
|
.optional()
|
|
119
|
-
.describe("Object
|
|
120
|
-
|
|
121
|
-
.
|
|
122
|
-
.regex(/^v\d+$/)
|
|
89
|
+
.describe("Object IDs (0x...) or LocalMark names to assemble context for. Required when action='assemble_context'. The current on-chain state of each object will be queried and enriched with semantic annotations."),
|
|
90
|
+
include_events: z
|
|
91
|
+
.boolean()
|
|
123
92
|
.optional()
|
|
124
|
-
.describe("
|
|
125
|
-
|
|
126
|
-
.
|
|
93
|
+
.describe("When true, assemble_context also queries recent state-transition events (NewOrderEvent, ProgressEvent, ArbEvent, etc.). Events are the real-time transition log — convergent and bounded. Defaults to false. Note: object-embedded history (ProgressSession.forwards, Order.disputes) is ALWAYS extracted automatically — no flag needed."),
|
|
94
|
+
context_network: z
|
|
95
|
+
.enum(["testnet", "mainnet"])
|
|
96
|
+
.optional()
|
|
97
|
+
.describe("Network for assemble_context queries. Defaults to 'testnet' if omitted."),
|
|
98
|
+
filter_status: z
|
|
99
|
+
.enum(["draft", "active", "inactive", "archived"])
|
|
100
|
+
.optional()
|
|
101
|
+
.describe("Filter list_projects by project status."),
|
|
102
|
+
filter_perspective: z
|
|
103
|
+
.enum(["producer", "consumer", "both"])
|
|
127
104
|
.optional()
|
|
128
|
-
.describe("
|
|
129
|
-
|
|
105
|
+
.describe("Filter list_projects by project perspective."),
|
|
106
|
+
filter_network: z
|
|
107
|
+
.enum(["testnet", "mainnet"])
|
|
108
|
+
.optional()
|
|
109
|
+
.describe("Filter list_projects by network."),
|
|
110
|
+
project_name: z
|
|
130
111
|
.string()
|
|
131
112
|
.min(1)
|
|
113
|
+
.max(200)
|
|
114
|
+
.optional()
|
|
115
|
+
.describe("Display name for create_project / create_project_from_onchain / update_project. Required when action='create_project'."),
|
|
116
|
+
project_description: z
|
|
117
|
+
.string()
|
|
132
118
|
.max(2000)
|
|
133
119
|
.optional()
|
|
134
|
-
.describe("
|
|
135
|
-
|
|
136
|
-
|
|
120
|
+
.describe("Project description for create_project / update_project."),
|
|
121
|
+
project_industry: IndustryEnum.optional().describe("Industry tag for create_project. Drives template defaults."),
|
|
122
|
+
project_perspective: z
|
|
123
|
+
.enum(["producer", "consumer", "both"])
|
|
124
|
+
.optional()
|
|
125
|
+
.describe("Project perspective for create_project. 'producer' = build/operate services, 'consumer' = evaluate/buy services, 'both' = dual role. Defaults to 'producer'."),
|
|
126
|
+
project_labels: z
|
|
137
127
|
.array(z.string())
|
|
138
128
|
.optional()
|
|
139
|
-
.describe("
|
|
140
|
-
|
|
141
|
-
.
|
|
129
|
+
.describe("Free-form labels for create_project / update_project (e.g. ['travel','london','priority'])."),
|
|
130
|
+
service_address: z
|
|
131
|
+
.string()
|
|
142
132
|
.optional()
|
|
143
|
-
.describe("
|
|
144
|
-
|
|
145
|
-
.enum(["
|
|
133
|
+
.describe("On-chain Service object address. Required for create_project_from_onchain. Optional for create_project (links the project to its core Service)."),
|
|
134
|
+
project_network: z
|
|
135
|
+
.enum(["testnet", "mainnet"])
|
|
146
136
|
.optional()
|
|
147
|
-
.describe("
|
|
148
|
-
|
|
149
|
-
.
|
|
137
|
+
.describe("Network the project is bound to. A Service deployed to different networks are different projects. Defaults to 'testnet'."),
|
|
138
|
+
project_id: z
|
|
139
|
+
.string()
|
|
140
|
+
.optional()
|
|
141
|
+
.describe("Project UUID for update_project / get_project_detail / add_object / remove_object / create_version / build_graph / evaluate_project / refresh_objects. Takes precedence over 'project' (prefix) when both are given."),
|
|
142
|
+
project_status: z
|
|
143
|
+
.enum(["draft", "active", "inactive", "archived"])
|
|
150
144
|
.optional()
|
|
151
|
-
.describe("
|
|
152
|
-
|
|
145
|
+
.describe("New status for update_project. 'active' projects are live, 'archived' are read-only."),
|
|
146
|
+
object_address: z
|
|
153
147
|
.string()
|
|
154
|
-
.min(1)
|
|
155
|
-
.max(500)
|
|
156
148
|
.optional()
|
|
157
|
-
.describe("
|
|
158
|
-
|
|
149
|
+
.describe("On-chain object address (0x...) for add_object / remove_object. For add_object, alternatively use object_name to resolve via LocalMark."),
|
|
150
|
+
object_name_add: z
|
|
159
151
|
.string()
|
|
160
152
|
.optional()
|
|
161
|
-
.describe("
|
|
162
|
-
|
|
163
|
-
.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
reused_from: z
|
|
169
|
-
.string()
|
|
170
|
-
.optional()
|
|
171
|
-
.describe("Existing on-chain address or local name if reused"),
|
|
172
|
-
publish_required: z
|
|
173
|
-
.boolean()
|
|
174
|
-
.describe("Whether publish is required (only Service/Machine)"),
|
|
175
|
-
description: z.string().optional(),
|
|
176
|
-
})
|
|
177
|
-
.strict())
|
|
153
|
+
.describe("LocalMark name for add_object (alternative to object_address)."),
|
|
154
|
+
object_type_add: z
|
|
155
|
+
.enum([
|
|
156
|
+
"Service", "Machine", "Guard", "Permission", "Reward", "Arbitration",
|
|
157
|
+
"Progress", "Treasury", "Demand", "Repository", "Contact", "Order",
|
|
158
|
+
"Allocation", "Personal", "Payment", "Proof",
|
|
159
|
+
])
|
|
178
160
|
.optional()
|
|
179
|
-
.describe("
|
|
180
|
-
|
|
181
|
-
.
|
|
182
|
-
.object({
|
|
183
|
-
from: z.string(),
|
|
184
|
-
to: z.string(),
|
|
185
|
-
edge_kind: EdgeKindEnum,
|
|
186
|
-
field_path: z.string(),
|
|
187
|
-
required_at_publish: z.boolean(),
|
|
188
|
-
})
|
|
189
|
-
.strict())
|
|
161
|
+
.describe("Object type for add_object."),
|
|
162
|
+
object_role: z
|
|
163
|
+
.enum(["core", "dependency", "reference"])
|
|
190
164
|
.optional()
|
|
191
|
-
.describe("
|
|
192
|
-
|
|
193
|
-
.array(z
|
|
194
|
-
.object({
|
|
195
|
-
step: z.number().int().positive(),
|
|
196
|
-
object_type: ProjectObjectTypeEnum,
|
|
197
|
-
operation: z.string(),
|
|
198
|
-
substep_count: z.number().int().nonnegative(),
|
|
199
|
-
depends_on: z.array(z.number().int()),
|
|
200
|
-
entry_id: z.string(),
|
|
201
|
-
network_phase: z.enum(["testnet", "mainnet", "both"]),
|
|
202
|
-
})
|
|
203
|
-
.strict())
|
|
165
|
+
.describe("Object role in project for add_object. 'core' = the Service (only one per project), 'dependency' = required binding, 'reference' = optional/auxiliary. Defaults to 'reference'."),
|
|
166
|
+
object_tags_add: z
|
|
167
|
+
.array(z.string())
|
|
204
168
|
.optional()
|
|
205
|
-
.describe("
|
|
206
|
-
|
|
207
|
-
.
|
|
208
|
-
.object({
|
|
209
|
-
scenario_id: z.string(),
|
|
210
|
-
description: z.string(),
|
|
211
|
-
primary_object: z.string(),
|
|
212
|
-
supporting_objects: z.array(z.string()),
|
|
213
|
-
test_step_refs: z.array(z.string()).optional(),
|
|
214
|
-
})
|
|
215
|
-
.strict())
|
|
169
|
+
.describe("Tags for add_object."),
|
|
170
|
+
object_id_remove: z
|
|
171
|
+
.string()
|
|
216
172
|
.optional()
|
|
217
|
-
.describe("
|
|
218
|
-
|
|
219
|
-
.
|
|
173
|
+
.describe("ProjectObject UUID for remove_object (the project_objects.id, NOT the on-chain address)."),
|
|
174
|
+
object_id_update: z
|
|
175
|
+
.string()
|
|
220
176
|
.optional()
|
|
221
|
-
.describe("
|
|
222
|
-
|
|
223
|
-
.
|
|
224
|
-
.int()
|
|
225
|
-
.nonnegative()
|
|
177
|
+
.describe("ProjectObject UUID for update_object (the project_objects.id)."),
|
|
178
|
+
object_name_update: z
|
|
179
|
+
.string()
|
|
226
180
|
.optional()
|
|
227
|
-
.describe("
|
|
228
|
-
|
|
229
|
-
.
|
|
230
|
-
.int()
|
|
231
|
-
.nonnegative()
|
|
181
|
+
.describe("New name for update_object."),
|
|
182
|
+
object_type_update: z
|
|
183
|
+
.string()
|
|
232
184
|
.optional()
|
|
233
|
-
.describe("
|
|
234
|
-
|
|
235
|
-
.
|
|
185
|
+
.describe("New type for update_object."),
|
|
186
|
+
object_role_update: z
|
|
187
|
+
.enum(["core", "dependency", "reference"])
|
|
236
188
|
.optional()
|
|
237
|
-
.describe("
|
|
238
|
-
|
|
239
|
-
.
|
|
240
|
-
network: z.enum(["testnet", "mainnet"]),
|
|
241
|
-
already_spent_gas: z
|
|
242
|
-
.number()
|
|
243
|
-
.int()
|
|
244
|
-
.nonnegative()
|
|
245
|
-
.optional()
|
|
246
|
-
.describe("Gas already spent on-chain in MIST (from telemetry). Defaults to 0."),
|
|
247
|
-
estimated_rerun_gas: z
|
|
248
|
-
.number()
|
|
249
|
-
.int()
|
|
250
|
-
.nonnegative()
|
|
251
|
-
.optional()
|
|
252
|
-
.describe("Estimated gas to re-run remaining ops in MIST. Auto-computed from estimateDeploymentGas when omitted."),
|
|
253
|
-
warning: z
|
|
254
|
-
.string()
|
|
255
|
-
.optional()
|
|
256
|
-
.describe("Custom warning text. Defaults to a computed cost summary."),
|
|
257
|
-
})
|
|
189
|
+
.describe("New role for update_object."),
|
|
190
|
+
object_tags_update: z
|
|
191
|
+
.array(z.string())
|
|
258
192
|
.optional()
|
|
259
|
-
.describe("
|
|
260
|
-
|
|
261
|
-
.
|
|
193
|
+
.describe("New tags for update_object."),
|
|
194
|
+
version_description: z
|
|
195
|
+
.string()
|
|
196
|
+
.max(500)
|
|
262
197
|
.optional()
|
|
263
|
-
.describe("
|
|
264
|
-
|
|
265
|
-
.
|
|
266
|
-
.object({
|
|
267
|
-
step_id: z.string().regex(/^T\d+\.\d+$/),
|
|
268
|
-
parent_step: z.string().regex(/^T\d+$/),
|
|
269
|
-
object_type: ProjectObjectTypeEnum,
|
|
270
|
-
entry_id: z.string(),
|
|
271
|
-
operation_type: z.string(),
|
|
272
|
-
network: z.enum(["testnet", "mainnet"]),
|
|
273
|
-
input: z.object({
|
|
274
|
-
data: z.record(z.unknown()),
|
|
275
|
-
input_refs: z.array(z.string()),
|
|
276
|
-
}),
|
|
277
|
-
output: z
|
|
278
|
-
.object({
|
|
279
|
-
object_id: z.string().optional(),
|
|
280
|
-
tx_digest: z.string().optional(),
|
|
281
|
-
})
|
|
282
|
-
.partial()
|
|
283
|
-
.optional(),
|
|
284
|
-
timestamp: z.number().int(),
|
|
285
|
-
status: z.enum(["PENDING", "SUCCESS", "FAILED", "SKIPPED"]),
|
|
286
|
-
failure_reason: z.string().optional(),
|
|
287
|
-
dependencies: z.object({
|
|
288
|
-
input_refs: z.array(z.string()),
|
|
289
|
-
output_refs: z.array(z.object({
|
|
290
|
-
substep_id: z.string(),
|
|
291
|
-
field_path: z.string(),
|
|
292
|
-
})),
|
|
293
|
-
}),
|
|
294
|
-
retry_info: z
|
|
295
|
-
.object({
|
|
296
|
-
original_step_id: z.string(),
|
|
297
|
-
retry_count: z.number().int().nonnegative(),
|
|
298
|
-
retry_reason: z.string(),
|
|
299
|
-
})
|
|
300
|
-
.optional(),
|
|
301
|
-
})
|
|
302
|
-
.strict())
|
|
198
|
+
.describe("Description for create_version."),
|
|
199
|
+
fork_from_version: z
|
|
200
|
+
.string()
|
|
303
201
|
.optional()
|
|
304
|
-
.describe("
|
|
305
|
-
|
|
202
|
+
.describe("Source version for create_version (fork objects + graph from this version)."),
|
|
203
|
+
max_depth: z
|
|
306
204
|
.number()
|
|
307
205
|
.int()
|
|
308
206
|
.min(1)
|
|
309
207
|
.max(5)
|
|
310
208
|
.optional()
|
|
311
|
-
.describe("
|
|
312
|
-
|
|
313
|
-
.
|
|
314
|
-
.optional()
|
|
315
|
-
.describe("Improvement proposal ID (for apply_improvement). Required by apply_improvement."),
|
|
316
|
-
review_status: z
|
|
317
|
-
.enum(["approved", "rejected", "applied"])
|
|
318
|
-
.optional()
|
|
319
|
-
.describe("New review status to set (for apply_improvement). 'approved' triggers application (config_override or source_patch); 'rejected' marks as rejected; 'applied' marks as already applied."),
|
|
320
|
-
queue_filter_status: z
|
|
321
|
-
.enum(["pending", "approved", "rejected", "applied"])
|
|
209
|
+
.describe("Max recursion depth for Pathway 1 (internal reference derivation) in build_graph. Default 3."),
|
|
210
|
+
enable_registrar: z
|
|
211
|
+
.boolean()
|
|
322
212
|
.optional()
|
|
323
|
-
.describe("
|
|
324
|
-
|
|
325
|
-
.
|
|
213
|
+
.describe("Enable Pathway 2 (Registrar inbound query) in build_graph. Default true."),
|
|
214
|
+
enable_potential: z
|
|
215
|
+
.boolean()
|
|
326
216
|
.optional()
|
|
327
|
-
.describe("
|
|
328
|
-
|
|
329
|
-
.
|
|
217
|
+
.describe("Enable Pathway 3 (potential relationship detection) in build_graph. Default false."),
|
|
218
|
+
evaluation_type: z
|
|
219
|
+
.enum(["risk", "trust", "completeness", "value", "worth_buying"])
|
|
330
220
|
.optional()
|
|
331
|
-
.describe("
|
|
332
|
-
|
|
221
|
+
.describe("Evaluation type for evaluate_project. risk/trust/completeness are rule-based (computed locally). worth_buying/value require LLM assistance (returns a prompt for the caller to process)."),
|
|
222
|
+
refresh_before_eval: z
|
|
333
223
|
.boolean()
|
|
334
224
|
.optional()
|
|
335
|
-
.describe("When true,
|
|
336
|
-
|
|
225
|
+
.describe("When true, evaluate_project refreshes object cache from chain before evaluating. Default false."),
|
|
226
|
+
eval_score: z
|
|
227
|
+
.number()
|
|
228
|
+
.min(0)
|
|
229
|
+
.max(100)
|
|
230
|
+
.optional()
|
|
231
|
+
.describe("Overall evaluation score (0-100) for save_evaluation."),
|
|
232
|
+
eval_summary: z
|
|
337
233
|
.string()
|
|
234
|
+
.max(1000)
|
|
338
235
|
.optional()
|
|
339
|
-
.describe("
|
|
340
|
-
|
|
341
|
-
.
|
|
236
|
+
.describe("Evaluation summary for save_evaluation."),
|
|
237
|
+
eval_details: z
|
|
238
|
+
.record(z.unknown())
|
|
342
239
|
.optional()
|
|
343
|
-
.describe("
|
|
344
|
-
|
|
240
|
+
.describe("Structured evaluation details for save_evaluation (criterion_scores, findings, etc.)."),
|
|
241
|
+
compare_project_ids: z
|
|
345
242
|
.array(z.string())
|
|
243
|
+
.min(2)
|
|
346
244
|
.optional()
|
|
347
|
-
.describe("
|
|
348
|
-
|
|
349
|
-
.
|
|
245
|
+
.describe("Array of project IDs to compare (for compare_projects). Minimum 2."),
|
|
246
|
+
diff_address: z
|
|
247
|
+
.string()
|
|
350
248
|
.optional()
|
|
351
|
-
.describe("
|
|
352
|
-
|
|
353
|
-
.
|
|
249
|
+
.describe("Object address for get_object_diff."),
|
|
250
|
+
diff_from_time: z
|
|
251
|
+
.number()
|
|
252
|
+
.int()
|
|
354
253
|
.optional()
|
|
355
|
-
.describe("
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
.object({
|
|
360
|
-
stage: z.number().int().min(1).max(5),
|
|
361
|
-
passed: z.boolean().describe("True when no FAIL checks exist."),
|
|
362
|
-
checks: z.array(z.object({
|
|
363
|
-
dimension: z.enum([
|
|
364
|
-
"semantic",
|
|
365
|
-
"tools",
|
|
366
|
-
"reversibility",
|
|
367
|
-
"risk",
|
|
368
|
-
"isolation",
|
|
369
|
-
"gas_budget",
|
|
370
|
-
]),
|
|
371
|
-
status: z.enum(["PASS", "FAIL", "WARN"]),
|
|
372
|
-
message: z.string(),
|
|
373
|
-
})),
|
|
374
|
-
blocking_issues: z.array(z.string()),
|
|
375
|
-
warnings: z.array(z.string()),
|
|
376
|
-
can_proceed: z.boolean(),
|
|
377
|
-
})
|
|
378
|
-
.optional()
|
|
379
|
-
.describe("Stage gate validation result (6 dimensions: semantic/tools/reversibility/risk/isolation/gas_budget).");
|
|
380
|
-
const ItemsResult = (action) => z.object({
|
|
381
|
-
action: z.literal(action),
|
|
382
|
-
items: z
|
|
383
|
-
.array(z.record(z.unknown()))
|
|
384
|
-
.describe("List of result items. Each item is an untyped record — shape varies per query."),
|
|
385
|
-
});
|
|
386
|
-
const AnalyzeIntentResultSchema = z
|
|
387
|
-
.object({
|
|
388
|
-
action: z.literal("analyze_intent"),
|
|
389
|
-
intent_parsed: z.object({
|
|
390
|
-
primary_object: z.string(),
|
|
391
|
-
secondary_objects: z.array(z.string()),
|
|
392
|
-
detected_scenes: z.array(z.object({
|
|
393
|
-
object: z.string(),
|
|
394
|
-
scene_id: z.string(),
|
|
395
|
-
})),
|
|
396
|
-
industry: z.string(),
|
|
397
|
-
keyword_matches: z.array(z.object({
|
|
398
|
-
keyword: z.string(),
|
|
399
|
-
category: z.string(),
|
|
400
|
-
matched_objects: z.array(z.string()),
|
|
401
|
-
required_level: z.enum(["R", "C", "OPTIONAL"]),
|
|
402
|
-
match_count: z.number().int(),
|
|
403
|
-
})),
|
|
404
|
-
}),
|
|
405
|
-
puzzles: z.record(z.string(), PuzzleEntrySchema),
|
|
406
|
-
overall_completeness: z.enum(["complete", "partial", "empty"]),
|
|
407
|
-
next_step: z.string(),
|
|
408
|
-
recommended_creation_order: z
|
|
409
|
-
.array(z.string())
|
|
410
|
-
.describe("Recommended object creation order based on dependency topology (e.g. ['permission','progress','guard','allocation','machine','service'])."),
|
|
411
|
-
next_action: z
|
|
412
|
-
.enum(["aggregate_risks", "none"])
|
|
413
|
-
.describe("Next project_operation action to call. 'aggregate_risks' when puzzles are complete enough; 'none' if user must fill missing fields first."),
|
|
414
|
-
warnings: z.array(z.string()),
|
|
415
|
-
gate_validation: GateValidationSchema,
|
|
416
|
-
})
|
|
417
|
-
.strict();
|
|
418
|
-
const AggregateRisksResultSchema = z
|
|
419
|
-
.object({
|
|
420
|
-
action: z.literal("aggregate_risks"),
|
|
421
|
-
namespace: z.object({
|
|
422
|
-
prefix: z.string(),
|
|
423
|
-
version: z.string(),
|
|
424
|
-
industry: z.string().optional(),
|
|
425
|
-
}),
|
|
426
|
-
findings: z.array(z.object({
|
|
427
|
-
risk_rule_id: z.string(),
|
|
428
|
-
object_type: z.string(),
|
|
429
|
-
entry_id: z.string(),
|
|
430
|
-
severity: z.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"]),
|
|
431
|
-
message: z.string(),
|
|
432
|
-
fix_suggestion: z.string(),
|
|
433
|
-
details: z
|
|
434
|
-
.object({
|
|
435
|
-
field_path: z.string().optional(),
|
|
436
|
-
rule_source: z.string().optional(),
|
|
437
|
-
})
|
|
438
|
-
.partial()
|
|
439
|
-
.optional(),
|
|
440
|
-
})),
|
|
441
|
-
severity_summary: z.object({
|
|
442
|
-
CRITICAL: z.number().int(),
|
|
443
|
-
HIGH: z.number().int(),
|
|
444
|
-
MEDIUM: z.number().int(),
|
|
445
|
-
LOW: z.number().int(),
|
|
446
|
-
INFO: z.number().int(),
|
|
447
|
-
}),
|
|
448
|
-
status: z.enum([
|
|
449
|
-
"RISK_PASSED",
|
|
450
|
-
"RISK_BLOCKED",
|
|
451
|
-
"RISK_PENDING_CONFIRM",
|
|
452
|
-
"RISK_CANCELLED",
|
|
453
|
-
]),
|
|
454
|
-
pending_confirmations: z
|
|
455
|
-
.array(z.object({
|
|
456
|
-
risk_rule_id: z.string(),
|
|
457
|
-
description: z.string(),
|
|
458
|
-
fix_suggestion: z.string(),
|
|
459
|
-
object_type: z.string(),
|
|
460
|
-
entry_id: z.string(),
|
|
461
|
-
}))
|
|
462
|
-
.optional(),
|
|
463
|
-
fix_suggestions_grouped: z
|
|
464
|
-
.record(z.string(), z.array(z.object({
|
|
465
|
-
risk_rule_id: z.string(),
|
|
466
|
-
severity: z.enum(["CRITICAL", "HIGH", "MEDIUM", "LOW", "INFO"]),
|
|
467
|
-
message: z.string(),
|
|
468
|
-
fix_suggestion: z.string(),
|
|
469
|
-
entry_id: z.string(),
|
|
470
|
-
})))
|
|
254
|
+
.describe("Start timestamp (ms) for get_object_diff."),
|
|
255
|
+
diff_to_time: z
|
|
256
|
+
.number()
|
|
257
|
+
.int()
|
|
471
258
|
.optional()
|
|
472
|
-
.describe("
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
259
|
+
.describe("End timestamp (ms) for get_object_diff."),
|
|
260
|
+
network: z
|
|
261
|
+
.enum(["testnet", "mainnet"])
|
|
262
|
+
.optional()
|
|
263
|
+
.describe("Target network for generate_deployment_doc. Required when action='generate_deployment_doc'."),
|
|
264
|
+
save: z
|
|
476
265
|
.boolean()
|
|
477
|
-
.
|
|
478
|
-
|
|
479
|
-
.enum(["generate_deployment_doc", "fix_risks", "none"])
|
|
480
|
-
.describe("Next project_operation action. 'generate_deployment_doc' when can_proceed=true; 'fix_risks' when CRITICAL risks exist; 'none' for other cases."),
|
|
481
|
-
user_action_required: z
|
|
482
|
-
.string()
|
|
483
|
-
.describe("Human-readable next-step guidance."),
|
|
484
|
-
gate_validation: GateValidationSchema,
|
|
266
|
+
.optional()
|
|
267
|
+
.describe("When true (default), persist the generated MD to SQLite project_documents table for generate_deployment_doc."),
|
|
485
268
|
})
|
|
486
269
|
.strict();
|
|
487
|
-
const
|
|
270
|
+
const AssembleContextResultSchema = z
|
|
488
271
|
.object({
|
|
489
|
-
action: z.literal("
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
object_count: z.number().int(),
|
|
496
|
-
step_count: z.number().int(),
|
|
497
|
-
}),
|
|
498
|
-
validation: z
|
|
499
|
-
.object({
|
|
500
|
-
valid: z.boolean(),
|
|
501
|
-
checks: z.array(z.object({
|
|
502
|
-
check_id: z.string(),
|
|
503
|
-
description: z.string(),
|
|
504
|
-
status: z.enum(["PASS", "FAIL", "WARN"]),
|
|
505
|
-
notes: z.string().optional(),
|
|
506
|
-
})),
|
|
507
|
-
errors: z.array(z.string()),
|
|
508
|
-
})
|
|
272
|
+
action: z.literal("assemble_context"),
|
|
273
|
+
objects: z
|
|
274
|
+
.array(z.unknown())
|
|
275
|
+
.describe("Current on-chain states of the requested objects (from query_objects)."),
|
|
276
|
+
events: z
|
|
277
|
+
.array(z.unknown())
|
|
509
278
|
.optional()
|
|
510
|
-
.describe("
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
per_object: z.array(z.object({
|
|
515
|
-
entry_id: z.string(),
|
|
516
|
-
object_type: z.string(),
|
|
517
|
-
create_gas_mist: z.number().int(),
|
|
518
|
-
publish_gas_mist: z.number().int(),
|
|
519
|
-
})),
|
|
520
|
-
publish_gas_mist: z.number().int().describe("Gas for publish operations only."),
|
|
521
|
-
})
|
|
279
|
+
.describe("Recent state-transition events (only when include_events=true). " +
|
|
280
|
+
"Includes NewOrderEvent, ProgressEvent, ArbEvent, etc."),
|
|
281
|
+
embedded_history: z
|
|
282
|
+
.record(z.string(), z.unknown())
|
|
522
283
|
.optional()
|
|
523
|
-
.describe("
|
|
524
|
-
|
|
284
|
+
.describe("Operation history extracted from object states — NOT from tx queries. " +
|
|
285
|
+
"Progress objects: session.forwards (who did what, when, accomplished). " +
|
|
286
|
+
"Order objects: disputes, claimed_by, progress_object. " +
|
|
287
|
+
"This is the CORRECT history source: convergent, no infinite recursion."),
|
|
288
|
+
semantic_summary: z
|
|
289
|
+
.unknown()
|
|
290
|
+
.optional()
|
|
291
|
+
.describe("Business semantic annotations generated by buildDataSemantic — " +
|
|
292
|
+
"maps raw object fields to business-meaningful concepts for LLM consumption."),
|
|
293
|
+
context_digest: z
|
|
294
|
+
.string()
|
|
295
|
+
.describe("Unique digest for this assembled context (SHA of object IDs + versions + timestamp). " +
|
|
296
|
+
"Use for caching or to detect state changes between two assembly calls."),
|
|
297
|
+
next_action: z
|
|
298
|
+
.string()
|
|
299
|
+
.describe("Suggested next action: use onchain_transaction to verify a specific past tx, " +
|
|
300
|
+
"or proceed with onchain_operations to modify state, or re-call assemble_context " +
|
|
301
|
+
"after state changes."),
|
|
302
|
+
flywheel_collected: z
|
|
525
303
|
.object({
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
all_stages_passed: z
|
|
530
|
-
.boolean()
|
|
531
|
-
.describe("Whether all 5 stage gates passed validation."),
|
|
304
|
+
signature_recorded: z.boolean().describe("Whether the experience signature was recorded in the real-time experience layer."),
|
|
305
|
+
proposal_created: z.boolean().describe("Whether an improvement proposal was created for the offline distillation flywheel."),
|
|
306
|
+
proposal_id: z.string().optional().describe("The proposal ID, if created."),
|
|
532
307
|
})
|
|
533
308
|
.optional()
|
|
534
|
-
.describe("
|
|
535
|
-
|
|
536
|
-
.boolean()
|
|
537
|
-
.describe("Whether the user can proceed to stage 5. False when D-errors exist."),
|
|
538
|
-
next_action: z
|
|
539
|
-
.enum(["trace_substeps", "fix_doc_errors", "none"])
|
|
540
|
-
.describe("Next project_operation action. 'trace_substeps' when can_proceed=true; 'fix_doc_errors' when D-errors exist; 'none' for other cases."),
|
|
541
|
-
user_action_required: z.string(),
|
|
542
|
-
gate_validation: GateValidationSchema,
|
|
309
|
+
.describe("Distillation flywheel collection result. Non-blocking — may be undefined if collection fails. " +
|
|
310
|
+
"When present, the assembled context has been fed back into the experience layer and/or improvement queue."),
|
|
543
311
|
})
|
|
544
312
|
.strict();
|
|
545
|
-
const
|
|
313
|
+
const ProjectObjectSchema = z
|
|
546
314
|
.object({
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
dangling_inputs: z.array(z.object({
|
|
557
|
-
substep_id: z.string(),
|
|
558
|
-
missing_ref: z.string(),
|
|
559
|
-
field_path: z.string(),
|
|
560
|
-
})),
|
|
561
|
-
circular_refs: z.array(z.object({
|
|
562
|
-
cycle: z.array(z.string()),
|
|
563
|
-
})),
|
|
564
|
-
missing_outputs: z.array(z.object({
|
|
565
|
-
substep_id: z.string(),
|
|
566
|
-
expected_field: z.string(),
|
|
567
|
-
dependent_substeps: z.array(z.string()),
|
|
568
|
-
})),
|
|
569
|
-
cross_step_breaks: z.array(z.object({
|
|
570
|
-
source_step: z.string(),
|
|
571
|
-
target_step: z.string(),
|
|
572
|
-
missing_field: z.string(),
|
|
573
|
-
})),
|
|
574
|
-
step_details: z.array(z.object({
|
|
575
|
-
parent_step: z.string(),
|
|
576
|
-
total_substeps: z.number().int(),
|
|
577
|
-
successful: z.number().int(),
|
|
578
|
-
failed: z.number().int(),
|
|
579
|
-
pending: z.number().int(),
|
|
580
|
-
skipped: z.number().int(),
|
|
581
|
-
substep_ids: z.array(z.string()),
|
|
582
|
-
})),
|
|
583
|
-
topological_order: z.array(z.string()),
|
|
584
|
-
d10_check: z.object({
|
|
585
|
-
check_id: z.literal("D-10"),
|
|
586
|
-
description: z.string(),
|
|
587
|
-
status: z.enum(["PASS", "FAIL", "WARN"]),
|
|
588
|
-
}),
|
|
589
|
-
can_proceed: z
|
|
590
|
-
.boolean()
|
|
591
|
-
.describe("Whether deployment can complete. False when D-10 fails or substeps FAILED."),
|
|
592
|
-
next_action: z
|
|
593
|
-
.enum(["deploy", "fix_substeps", "none"])
|
|
594
|
-
.describe("Next action. 'deploy' when can_proceed=true (execute substeps via onchain_operations); 'fix_substeps' when issues exist; 'none' when done."),
|
|
595
|
-
user_action_required: z.string(),
|
|
596
|
-
gate_validation: GateValidationSchema,
|
|
315
|
+
id: z.string().describe("ProjectObject UUID (project_objects.id)."),
|
|
316
|
+
projectId: z.string().describe("Owning project UUID."),
|
|
317
|
+
objectAddress: z.string().describe("On-chain object address (0x...)."),
|
|
318
|
+
objectType: z.string().nullable().describe("Object type (Service, Machine, etc.) or null if unknown."),
|
|
319
|
+
objectName: z.string().nullable().describe("LocalMark name or null."),
|
|
320
|
+
role: z.enum(["core", "dependency", "reference"]).describe("Object role in project."),
|
|
321
|
+
tags: z.array(z.string()).nullable().describe("Tags array or null."),
|
|
322
|
+
addedAt: z.number().describe("Timestamp (ms) when added to project."),
|
|
323
|
+
metadata: z.record(z.unknown()).nullable().describe("Arbitrary metadata key-value pairs or null."),
|
|
597
324
|
})
|
|
598
325
|
.strict();
|
|
599
|
-
const
|
|
326
|
+
const ProjectSchema = z
|
|
600
327
|
.object({
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
328
|
+
id: z.string().describe("Project UUID."),
|
|
329
|
+
prefix: z.string().describe("Human-readable unique prefix."),
|
|
330
|
+
name: z.string().describe("Display name."),
|
|
331
|
+
description: z.string().nullable(),
|
|
332
|
+
industry: z.string().nullable(),
|
|
333
|
+
perspective: z.enum(["producer", "consumer", "both"]),
|
|
334
|
+
status: z.enum(["draft", "active", "inactive", "archived"]),
|
|
335
|
+
labels: z.array(z.string()).nullable(),
|
|
336
|
+
currentVersion: z.string().nullable().describe("Current version tag (e.g. 'v1')."),
|
|
337
|
+
serviceAddress: z.string().nullable().describe("Core Service on-chain address (producer projects)."),
|
|
338
|
+
defaultAccount: z.string().nullable(),
|
|
339
|
+
network: z.string().describe("Network the project is bound to."),
|
|
340
|
+
createdAt: z.number(),
|
|
341
|
+
updatedAt: z.number(),
|
|
342
|
+
metadata: z.record(z.unknown()).nullable().describe("Arbitrary metadata key-value pairs or null."),
|
|
614
343
|
})
|
|
615
344
|
.strict();
|
|
616
|
-
const
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
initialized: z.boolean(),
|
|
621
|
-
archived: z.boolean(),
|
|
622
|
-
needs_migration: z.boolean().describe("Whether schema_version differs from current."),
|
|
623
|
-
forked_from: z.string().optional(),
|
|
624
|
-
chain_exists: z.boolean().describe("Whether the project prefix exists on-chain."),
|
|
625
|
-
sync_status: z
|
|
626
|
-
.enum(["synced", "local_only", "archived", "uninitialized"])
|
|
627
|
-
.describe("Cross-validation of local filesystem vs chain truth."),
|
|
345
|
+
const ProjectListItemSchema = ProjectSchema.extend({
|
|
346
|
+
objectCount: z.number().describe("Number of objects in this project (from project_objects table)."),
|
|
347
|
+
evaluationCount: z.number().describe("Number of stored evaluations for this project (from evaluations table)."),
|
|
348
|
+
objectTypes: z.array(z.string()).describe("Distinct object types in this project (e.g. ['Service','Machine'])."),
|
|
628
349
|
});
|
|
629
|
-
const
|
|
350
|
+
const ListProjectsResultSchema = z
|
|
630
351
|
.object({
|
|
631
|
-
action: z.literal("
|
|
632
|
-
items: z.array(
|
|
633
|
-
total: z.number().
|
|
634
|
-
project: z.string().optional(),
|
|
635
|
-
version: z.string().optional(),
|
|
636
|
-
local_exists: z.boolean().optional(),
|
|
637
|
-
manifest: z
|
|
638
|
-
.object({
|
|
639
|
-
schema_version: z.string(),
|
|
640
|
-
mcp_version: z.string(),
|
|
641
|
-
prefix: z.string(),
|
|
642
|
-
version: z.string(),
|
|
643
|
-
created_at: z.string(),
|
|
644
|
-
updated_at: z.string(),
|
|
645
|
-
forked_from: z.string().optional(),
|
|
646
|
-
needs_recalibration: z.boolean().optional(),
|
|
647
|
-
})
|
|
648
|
-
.optional(),
|
|
649
|
-
stage_state: z
|
|
650
|
-
.object({
|
|
651
|
-
stage: z.number().int().min(1).max(5),
|
|
652
|
-
updated_at: z.number().int(),
|
|
653
|
-
has_published_object: z.boolean(),
|
|
654
|
-
archived: z.boolean(),
|
|
655
|
-
})
|
|
656
|
-
.partial()
|
|
657
|
-
.optional(),
|
|
658
|
-
sync_status: z
|
|
659
|
-
.object({
|
|
660
|
-
local_exists: z.boolean(),
|
|
661
|
-
initialized: z.boolean(),
|
|
662
|
-
needs_migration: z.boolean(),
|
|
663
|
-
archived: z.boolean(),
|
|
664
|
-
})
|
|
665
|
-
.optional(),
|
|
666
|
-
migration: z
|
|
667
|
-
.object({
|
|
668
|
-
migrated: z.boolean().describe("Whether a migration was performed."),
|
|
669
|
-
from_version: z.string(),
|
|
670
|
-
to_version: z.string(),
|
|
671
|
-
steps_executed: z.array(z.string()),
|
|
672
|
-
backup_path: z.string().optional(),
|
|
673
|
-
needs_recalibration: z.boolean(),
|
|
674
|
-
message: z.string(),
|
|
675
|
-
})
|
|
676
|
-
.optional(),
|
|
677
|
-
message: z.string().optional(),
|
|
352
|
+
action: z.literal("list_projects"),
|
|
353
|
+
items: z.array(ProjectListItemSchema).describe("GLM6 projects from SQLite (first-class entities, with object summary)."),
|
|
354
|
+
total: z.number().describe("Total number of projects returned."),
|
|
678
355
|
})
|
|
679
356
|
.strict();
|
|
680
|
-
const
|
|
681
|
-
.object({
|
|
682
|
-
action: z.literal("fork_project"),
|
|
683
|
-
new_prefix: z.string(),
|
|
684
|
-
new_version: z.string(),
|
|
685
|
-
new_path: z.string().describe("Absolute filesystem path of the new project directory."),
|
|
686
|
-
forked_from: z
|
|
687
|
-
.string()
|
|
688
|
-
.describe("Absolute path of the source project directory."),
|
|
689
|
-
copied_files: z
|
|
690
|
-
.array(z.string())
|
|
691
|
-
.describe("Project-relative paths of copied files (excludes stage.json + audit.jsonl)."),
|
|
692
|
-
copied_file_count: z.number().int(),
|
|
693
|
-
warning: z
|
|
694
|
-
.string()
|
|
695
|
-
.describe("Project isolation notice — forked project must re-create its own objects."),
|
|
696
|
-
next_action: z
|
|
697
|
-
.literal("analyze_intent")
|
|
698
|
-
.describe("The forked project starts at stage 2 (analyze_intent)."),
|
|
699
|
-
})
|
|
357
|
+
const CreateProjectResultSchema = z
|
|
358
|
+
.object({ action: z.literal("create_project"), project: ProjectSchema.describe("The created project.") })
|
|
700
359
|
.strict();
|
|
701
|
-
const
|
|
360
|
+
const CreateProjectFromOnchainResultSchema = z
|
|
702
361
|
.object({
|
|
703
|
-
action: z.literal("
|
|
704
|
-
project:
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
path: z.string().describe("Project-relative file path."),
|
|
708
|
-
size: z.number().int().describe("File size in bytes."),
|
|
709
|
-
kind: z.enum(["json", "markdown", "jsonl", "other"]),
|
|
710
|
-
content: z.string().describe("File content (text)."),
|
|
711
|
-
})),
|
|
712
|
-
total_files: z.number().int(),
|
|
362
|
+
action: z.literal("create_project_from_onchain"),
|
|
363
|
+
project: ProjectSchema.describe("The created consumer project."),
|
|
364
|
+
objects: z.array(ProjectObjectSchema).describe("Objects discovered from on-chain Service + graph traversal."),
|
|
365
|
+
graphEdgeCount: z.number().describe("Number of relationship edges discovered and persisted."),
|
|
713
366
|
})
|
|
714
367
|
.strict();
|
|
715
|
-
const
|
|
368
|
+
const UpdateProjectResultSchema = z
|
|
369
|
+
.object({ action: z.literal("update_project"), project: ProjectSchema.describe("The updated project.") })
|
|
370
|
+
.strict();
|
|
371
|
+
const EvaluationDetailsSchema = z
|
|
716
372
|
.object({
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
373
|
+
criterionScores: z
|
|
374
|
+
.array(z.object({
|
|
375
|
+
name: z.string().describe("Criterion name (e.g. 'Service Published', 'Governance Present')."),
|
|
376
|
+
score: z.number().describe("Per-criterion score (0-100, higher = better)."),
|
|
377
|
+
weight: z.number().describe("Weight in the overall score (0-1)."),
|
|
378
|
+
rationale: z.string().describe("Why this score was assigned."),
|
|
379
|
+
}).strict())
|
|
380
|
+
.describe("Per-criterion scores with rationale."),
|
|
381
|
+
findings: z
|
|
382
|
+
.array(z.object({
|
|
383
|
+
criterion: z.string().describe("Criterion this finding relates to."),
|
|
384
|
+
severity: z.enum(["critical", "warning", "info"]).describe("Severity level: critical (blocks deployment), warning (should fix), info (advisory)."),
|
|
385
|
+
message: z.string().describe("Human-readable finding description."),
|
|
386
|
+
deduction: z.number().describe("Score deduction applied (negative number, e.g. -20)."),
|
|
387
|
+
}).strict())
|
|
388
|
+
.describe("Negative findings (warnings/critical issues) with deductions."),
|
|
389
|
+
strengths: z
|
|
390
|
+
.array(z.string())
|
|
391
|
+
.describe("Positive evidence explaining high scores."),
|
|
727
392
|
})
|
|
728
393
|
.strict();
|
|
729
|
-
const
|
|
394
|
+
const GetProjectDetailResultSchema = z
|
|
730
395
|
.object({
|
|
731
|
-
action: z.literal("
|
|
732
|
-
project:
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
.
|
|
737
|
-
.
|
|
738
|
-
|
|
739
|
-
.
|
|
740
|
-
.
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
.
|
|
749
|
-
.
|
|
750
|
-
|
|
396
|
+
action: z.literal("get_project_detail"),
|
|
397
|
+
project: ProjectSchema,
|
|
398
|
+
objects: z.array(ProjectObjectSchema).describe("Project objects (rigid relationships)."),
|
|
399
|
+
graphEdgeCount: z.number().describe("Number of persisted graph edges."),
|
|
400
|
+
evaluations: z
|
|
401
|
+
.array(z.object({
|
|
402
|
+
id: z.string(),
|
|
403
|
+
evalType: z.enum(["risk", "trust", "completeness", "value", "worth_buying"]),
|
|
404
|
+
score: z.number().nullable(),
|
|
405
|
+
summary: z.string().nullable(),
|
|
406
|
+
details: EvaluationDetailsSchema.nullable().describe("Structured inspection content (criterion scores, findings, strengths). Null for evaluations created before details were stored."),
|
|
407
|
+
evaluatedAt: z.number(),
|
|
408
|
+
}).strict())
|
|
409
|
+
.describe("Stored evaluation results (most recent first)."),
|
|
410
|
+
versions: z
|
|
411
|
+
.array(z.object({
|
|
412
|
+
version: z.string(),
|
|
413
|
+
description: z.string().nullable(),
|
|
414
|
+
createdAt: z.number(),
|
|
415
|
+
}).strict())
|
|
416
|
+
.describe("Project version history."),
|
|
751
417
|
})
|
|
752
418
|
.strict();
|
|
753
|
-
const
|
|
419
|
+
const AddObjectResultSchema = z
|
|
420
|
+
.object({ action: z.literal("add_object"), object: ProjectObjectSchema.describe("The added project-object relationship.") })
|
|
421
|
+
.strict();
|
|
422
|
+
const RemoveObjectResultSchema = z
|
|
423
|
+
.object({ action: z.literal("remove_object"), removed: z.literal(true).describe("Always true — confirms removal.") })
|
|
424
|
+
.strict();
|
|
425
|
+
const UpdateObjectResultSchema = z
|
|
754
426
|
.object({
|
|
755
|
-
action: z.literal("
|
|
756
|
-
|
|
757
|
-
version: z.string(),
|
|
758
|
-
stage: z.number().int().min(1).max(5),
|
|
759
|
-
found: z.boolean(),
|
|
760
|
-
assessment: z
|
|
761
|
-
.object({
|
|
762
|
-
stage: z.number().int().min(1).max(5),
|
|
763
|
-
assessed_at: z.number().int(),
|
|
764
|
-
goal_completion: z.record(z.number()),
|
|
765
|
-
findings: z.array(z.object({
|
|
766
|
-
finding_id: z.string(),
|
|
767
|
-
severity: z.enum(["info", "warn", "critical"]),
|
|
768
|
-
criterion_id: z.string(),
|
|
769
|
-
description: z.string(),
|
|
770
|
-
evidence: z.unknown(),
|
|
771
|
-
})),
|
|
772
|
-
recommendations: z.array(z.string()),
|
|
773
|
-
})
|
|
774
|
-
.optional()
|
|
775
|
-
.describe("The stage assessment object (from assessment.json)."),
|
|
427
|
+
action: z.literal("update_object"),
|
|
428
|
+
object: ProjectObjectSchema.describe("The updated project-object relationship."),
|
|
776
429
|
})
|
|
777
430
|
.strict();
|
|
778
|
-
const
|
|
431
|
+
const CreateVersionResultSchema = z
|
|
779
432
|
.object({
|
|
780
|
-
action: z.literal("
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
.object({
|
|
787
|
-
stage: z.number().int().min(1).max(5),
|
|
788
|
-
risks: z.array(z.object({
|
|
789
|
-
risk_id: z.string(),
|
|
790
|
-
category: z.enum([
|
|
791
|
-
"naming",
|
|
792
|
-
"dependency",
|
|
793
|
-
"operational",
|
|
794
|
-
"financial",
|
|
795
|
-
"security",
|
|
796
|
-
]),
|
|
797
|
-
description: z.string(),
|
|
798
|
-
likelihood: z.enum(["low", "medium", "high"]),
|
|
799
|
-
impact: z.enum(["low", "medium", "high", "critical"]),
|
|
800
|
-
mitigation: z.string(),
|
|
801
|
-
owner: z.enum(["ai", "user", "system"]),
|
|
802
|
-
})),
|
|
803
|
-
active_controls: z.array(z.object({
|
|
804
|
-
control_id: z.string(),
|
|
805
|
-
control_type: z.enum(["preventive", "detective", "corrective"]),
|
|
806
|
-
target_risk: z.string(),
|
|
807
|
-
implementation: z.string(),
|
|
808
|
-
verified: z.boolean(),
|
|
809
|
-
})),
|
|
810
|
-
residual_risks: z.array(z.string()),
|
|
811
|
-
})
|
|
812
|
-
.optional()
|
|
813
|
-
.describe("The stage risk policy object (from risk-policy.json)."),
|
|
433
|
+
action: z.literal("create_version"),
|
|
434
|
+
version: z.object({
|
|
435
|
+
version: z.string().describe("Version tag (e.g. 'v2')."),
|
|
436
|
+
description: z.string().nullable(),
|
|
437
|
+
createdAt: z.number(),
|
|
438
|
+
}).strict(),
|
|
814
439
|
})
|
|
815
440
|
.strict();
|
|
816
|
-
const
|
|
441
|
+
const BuildGraphResultSchema = z
|
|
817
442
|
.object({
|
|
818
|
-
action: z.literal("
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
version: z.string(),
|
|
825
|
-
generated_at: z.number().int(),
|
|
826
|
-
project_invariants: z.array(z.object({
|
|
827
|
-
invariant_id: z.string(),
|
|
828
|
-
description: z.string(),
|
|
829
|
-
verified_by_stages: z.array(z.number().int()),
|
|
830
|
-
})),
|
|
831
|
-
stage_units: z.array(z.object({
|
|
832
|
-
stage: z.number().int().min(1).max(5),
|
|
833
|
-
goal_id: z.string(),
|
|
834
|
-
assessment_id: z.string(),
|
|
835
|
-
risk_policy_id: z.string(),
|
|
836
|
-
verification_id: z.string(),
|
|
837
|
-
artifacts: z.array(z.string()),
|
|
838
|
-
})),
|
|
839
|
-
derivations: z.array(z.object({
|
|
840
|
-
source_type: z.enum(["project_invariant", "project_goal"]),
|
|
841
|
-
source_id: z.string(),
|
|
842
|
-
target_type: z.enum(["stage_goal", "stage_risk", "stage_verification"]),
|
|
843
|
-
target_stage: z.number().int().min(1).max(5),
|
|
844
|
-
target_id: z.string(),
|
|
845
|
-
derivation_logic: z.string(),
|
|
846
|
-
})),
|
|
847
|
-
propagation_rules: z.array(z.object({
|
|
848
|
-
rule_id: z.string(),
|
|
849
|
-
trigger: z.object({
|
|
850
|
-
stage: z.number().int(),
|
|
851
|
-
event: z.enum(["verification_passed", "verification_failed"]),
|
|
852
|
-
}),
|
|
853
|
-
effect: z.object({
|
|
854
|
-
target: z.enum(["project_invariant", "next_stage"]),
|
|
855
|
-
action: z.enum(["verify", "block"]),
|
|
856
|
-
}),
|
|
857
|
-
})),
|
|
858
|
-
impact_map: z.record(z.array(z.string())),
|
|
859
|
-
})
|
|
860
|
-
.optional()
|
|
861
|
-
.describe("The validation chain graph (from relations.json)."),
|
|
443
|
+
action: z.literal("build_graph"),
|
|
444
|
+
nodeCount: z.number().describe("Total nodes in the constructed graph."),
|
|
445
|
+
edgeCount: z.number().describe("Total edges (after conflict resolution + dedup)."),
|
|
446
|
+
edgesBySource: z.record(z.string(), z.number()).describe("Edge counts by source: { internal: N, registrar: N, potential: N }."),
|
|
447
|
+
reputationCount: z.number().describe("Number of objects with Registrar reputation data."),
|
|
448
|
+
builtAt: z.number().describe("Build timestamp (ms)."),
|
|
862
449
|
})
|
|
863
450
|
.strict();
|
|
864
|
-
const
|
|
451
|
+
const GetGraphResultSchema = z
|
|
865
452
|
.object({
|
|
866
|
-
action: z.literal("
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
.
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
.
|
|
876
|
-
.
|
|
877
|
-
|
|
878
|
-
.object({
|
|
879
|
-
stages_affected: z.array(z.number().int()).describe("Stage numbers whose content changed."),
|
|
880
|
-
relations_rebuilt: z.boolean().describe("Whether relations.json was regenerated."),
|
|
881
|
-
})
|
|
882
|
-
.describe("Summary of what changed (based on relations.json impact analysis)."),
|
|
883
|
-
next_action: z
|
|
884
|
-
.enum(["validate_validation_chain", "trace_substeps", "none"])
|
|
885
|
-
.describe("Next action: validate the chain after update, or proceed to trace_substeps."),
|
|
453
|
+
action: z.literal("get_graph"),
|
|
454
|
+
edges: z.array(z.object({
|
|
455
|
+
sourceObject: z.string(),
|
|
456
|
+
targetObject: z.string(),
|
|
457
|
+
edgeSource: z.enum(["internal", "registrar", "potential"]),
|
|
458
|
+
relationshipType: z.string(),
|
|
459
|
+
fieldName: z.string().nullable(),
|
|
460
|
+
depth: z.number(),
|
|
461
|
+
verified: z.boolean(),
|
|
462
|
+
weight: z.number(),
|
|
463
|
+
direction: z.string().nullable(),
|
|
464
|
+
}).strict()).describe("Persisted graph edges."),
|
|
886
465
|
})
|
|
887
466
|
.strict();
|
|
888
|
-
const
|
|
467
|
+
const EvaluateProjectResultSchema = z
|
|
889
468
|
.object({
|
|
890
|
-
action: z.literal("
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
.
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
})),
|
|
901
|
-
propagation_checks: z.array(z.object({
|
|
902
|
-
check_id: z.string(),
|
|
903
|
-
status: z.enum(["pass", "fail", "warn"]),
|
|
904
|
-
message: z.string(),
|
|
905
|
-
})),
|
|
906
|
-
cross_stage_checks: z.array(z.object({
|
|
907
|
-
check_id: z.string(),
|
|
908
|
-
status: z.enum(["pass", "fail", "warn"]),
|
|
909
|
-
message: z.string(),
|
|
910
|
-
})),
|
|
911
|
-
impact_map_checks: z.array(z.object({
|
|
912
|
-
check_id: z.string(),
|
|
913
|
-
status: z.enum(["pass", "fail", "warn"]),
|
|
469
|
+
action: z.literal("evaluate_project"),
|
|
470
|
+
evaluationType: z.enum(["risk", "trust", "completeness", "value", "worth_buying"]),
|
|
471
|
+
score: z.number().describe("Overall score (0-100, higher = better). 0 when needsLlm=true."),
|
|
472
|
+
summary: z.string(),
|
|
473
|
+
criterionScores: z.array(z.object({
|
|
474
|
+
name: z.string(), score: z.number(), weight: z.number(), rationale: z.string(),
|
|
475
|
+
}).strict()).describe("Per-criterion scores. Empty when needsLlm=true."),
|
|
476
|
+
findings: z.array(z.object({
|
|
477
|
+
criterion: z.string(),
|
|
478
|
+
severity: z.enum(["critical", "warning", "info"]),
|
|
914
479
|
message: z.string(),
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
480
|
+
deduction: z.number(),
|
|
481
|
+
}).strict()).describe("Negative findings (deductions). Empty when needsLlm=true."),
|
|
482
|
+
strengths: z.array(z.string()).describe("Positive evidence. Empty when needsLlm=true."),
|
|
483
|
+
needsLlm: z.boolean().describe("True for worth_buying/value evaluations. When true, process the llmPrompt with an LLM and call save_evaluation to store the result."),
|
|
484
|
+
llmPrompt: z.string().optional().describe("Present when needsLlm=true. Send this prompt to an LLM, parse the JSON response, and call save_evaluation."),
|
|
485
|
+
evaluationId: z.string().describe("ID of the stored evaluation record (for rule-based types). Empty for LLM-assisted types."),
|
|
918
486
|
})
|
|
919
487
|
.strict();
|
|
920
|
-
const
|
|
488
|
+
const SaveEvaluationResultSchema = z
|
|
921
489
|
.object({
|
|
922
|
-
action: z.literal("
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
.
|
|
928
|
-
.
|
|
929
|
-
|
|
930
|
-
override_file: z
|
|
931
|
-
.string()
|
|
932
|
-
.optional()
|
|
933
|
-
.describe("Path of the override file written (config_override only)."),
|
|
934
|
-
patch_file: z
|
|
935
|
-
.string()
|
|
936
|
-
.optional()
|
|
937
|
-
.describe("Path of the patch file written (source_patch only)."),
|
|
938
|
-
message: z.string(),
|
|
939
|
-
next_action: z
|
|
940
|
-
.enum(["get_improvement_queue", "get_flywheel_config", "none"])
|
|
941
|
-
.describe("Next action: check more proposals or view flywheel status."),
|
|
490
|
+
action: z.literal("save_evaluation"),
|
|
491
|
+
evaluation: z.object({
|
|
492
|
+
id: z.string(),
|
|
493
|
+
evalType: z.enum(["risk", "trust", "completeness", "value", "worth_buying"]),
|
|
494
|
+
score: z.number().nullable(),
|
|
495
|
+
summary: z.string().nullable(),
|
|
496
|
+
evaluatedAt: z.number(),
|
|
497
|
+
}).strict().describe("The stored evaluation record."),
|
|
942
498
|
})
|
|
943
499
|
.strict();
|
|
944
|
-
const
|
|
500
|
+
const CompareProjectsResultSchema = z
|
|
945
501
|
.object({
|
|
946
|
-
action: z.literal("
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
override_category: z.string().optional(),
|
|
957
|
-
title: z.string(),
|
|
958
|
-
description: z.string(),
|
|
959
|
-
target: z.string(),
|
|
960
|
-
review_status: z.enum(["pending", "approved", "rejected", "applied"]),
|
|
961
|
-
ab_test_recommended: z.boolean(),
|
|
962
|
-
persisted_at: z.string().optional(),
|
|
963
|
-
reviewed_at: z.string().optional(),
|
|
964
|
-
})),
|
|
965
|
-
summary: z.string(),
|
|
502
|
+
action: z.literal("compare_projects"),
|
|
503
|
+
evaluationType: z.enum(["risk", "trust", "completeness", "value", "worth_buying"]),
|
|
504
|
+
ranking: z.array(z.object({
|
|
505
|
+
projectId: z.string(),
|
|
506
|
+
projectName: z.string(),
|
|
507
|
+
score: z.number().nullable(),
|
|
508
|
+
summary: z.string().nullable(),
|
|
509
|
+
evaluatedAt: z.number().nullable(),
|
|
510
|
+
}).strict()).describe("Projects sorted by score descending (nulls last)."),
|
|
511
|
+
bestProjectId: z.string().nullable().describe("Project ID with the highest score, or null if none have evaluations."),
|
|
966
512
|
})
|
|
967
513
|
.strict();
|
|
968
|
-
const
|
|
514
|
+
const RefreshObjectsResultSchema = z
|
|
969
515
|
.object({
|
|
970
|
-
action: z.literal("
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
total_proposals: z.number().int(),
|
|
975
|
-
pending_count: z.number().int(),
|
|
976
|
-
approved_count: z.number().int(),
|
|
977
|
-
applied_count: z.number().int(),
|
|
978
|
-
rejected_count: z.number().int(),
|
|
979
|
-
override_files: z.array(z.string()),
|
|
980
|
-
recent_proposals: z.array(z.object({
|
|
981
|
-
proposal_id: z.string(),
|
|
982
|
-
type: z.string(),
|
|
983
|
-
priority: z.string(),
|
|
984
|
-
review_status: z.enum(["pending", "approved", "rejected", "applied"]),
|
|
985
|
-
title: z.string(),
|
|
986
|
-
})),
|
|
987
|
-
reflow_status: z
|
|
988
|
-
.enum(["active", "idle", "blocked"])
|
|
989
|
-
.describe("active=pending proposals exist; idle=no proposals; blocked=approved but not applied."),
|
|
516
|
+
action: z.literal("refresh_objects"),
|
|
517
|
+
refreshedCount: z.number().describe("Number of objects re-fetched from chain."),
|
|
518
|
+
failedCount: z.number().describe("Number of objects that failed to refresh."),
|
|
519
|
+
refreshedAt: z.number().describe("Refresh timestamp (ms)."),
|
|
990
520
|
})
|
|
991
521
|
.strict();
|
|
992
|
-
const
|
|
522
|
+
const DeleteProjectResultSchema = z
|
|
993
523
|
.object({
|
|
994
|
-
action: z.literal("
|
|
995
|
-
|
|
996
|
-
dry_run: z.boolean().describe("Whether this was a policy evaluation only (no execution)."),
|
|
997
|
-
target_stage: z.number().int().min(1).max(5),
|
|
998
|
-
previous_stage: z.number().int().min(1).max(5),
|
|
999
|
-
allowed: z.boolean().describe("Whether the rollback is allowed by policy."),
|
|
1000
|
-
block_reason: z.string().optional().describe("Present when allowed=false — explains why rollback is blocked."),
|
|
1001
|
-
files_to_clean: z
|
|
1002
|
-
.array(z.string())
|
|
1003
|
-
.describe("Files/directories that will be (or were) deleted during rollback."),
|
|
1004
|
-
files_cleaned: z
|
|
1005
|
-
.array(z.string())
|
|
1006
|
-
.describe("Files/directories actually deleted (empty in dry_run mode)."),
|
|
1007
|
-
warnings: z.array(z.string()).describe("Non-blocking warnings (e.g., data loss reminder)."),
|
|
1008
|
-
iteration_strategy: z.object({
|
|
1009
|
-
strategy: z.enum(["in_place", "fork"]),
|
|
1010
|
-
reason: z.string(),
|
|
1011
|
-
fork_to_version: z.string().optional(),
|
|
1012
|
-
published_objects: z.array(z.string()).optional(),
|
|
1013
|
-
}),
|
|
1014
|
-
message: z.string().describe("Human-readable summary."),
|
|
524
|
+
action: z.literal("delete_project"),
|
|
525
|
+
deleted: z.literal(true).describe("Always true — confirms deletion of the project and all associated objects, evaluations, versions, and graph edges."),
|
|
1015
526
|
})
|
|
1016
527
|
.strict();
|
|
1017
|
-
const
|
|
528
|
+
const GetObjectDiffResultSchema = z
|
|
1018
529
|
.object({
|
|
1019
|
-
action: z.literal("
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
.describe("
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
struct_reversible: z.enum(["reversible", "limited", "immutable"]),
|
|
1030
|
-
behavior_reversible: z.boolean(),
|
|
1031
|
-
gas_impact: z.enum(["low", "medium", "high", "none"]),
|
|
1032
|
-
explanation: z.string(),
|
|
1033
|
-
})),
|
|
1034
|
-
total: z.number().int().describe("Number of matrix entries returned."),
|
|
530
|
+
action: z.literal("get_object_diff"),
|
|
531
|
+
address: z.string(),
|
|
532
|
+
fromTime: z.number(),
|
|
533
|
+
toTime: z.number(),
|
|
534
|
+
changedFields: z.array(z.object({
|
|
535
|
+
fieldPath: z.string().describe("Dotted field path (e.g. 'machine', 'sales[0].price')."),
|
|
536
|
+
oldValue: z.unknown().describe("Previous value (null if field was added)."),
|
|
537
|
+
newValue: z.unknown().describe("New value (null if field was removed)."),
|
|
538
|
+
changeType: z.enum(["added", "removed", "modified"]),
|
|
539
|
+
}).strict()).describe("Changed fields between the two timestamps."),
|
|
1035
540
|
})
|
|
1036
541
|
.strict();
|
|
1037
|
-
const
|
|
542
|
+
const GenerateDeploymentDocResultSchema = z
|
|
1038
543
|
.object({
|
|
1039
|
-
action: z.literal("
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
.describe("
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
.
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
"Progress objects: session.forwards (who did what, when, accomplished). " +
|
|
1053
|
-
"Order objects: disputes, claimed_by, progress_object. " +
|
|
1054
|
-
"This is the CORRECT history source: convergent, no infinite recursion."),
|
|
1055
|
-
semantic_summary: z
|
|
1056
|
-
.unknown()
|
|
1057
|
-
.optional()
|
|
1058
|
-
.describe("Business semantic annotations generated by buildDataSemantic — " +
|
|
1059
|
-
"maps raw object fields to business-meaningful concepts for LLM consumption."),
|
|
1060
|
-
context_digest: z
|
|
1061
|
-
.string()
|
|
1062
|
-
.describe("Unique digest for this assembled context (SHA of object IDs + versions + timestamp). " +
|
|
1063
|
-
"Use for caching or to detect state changes between two assembly calls."),
|
|
1064
|
-
next_action: z
|
|
1065
|
-
.string()
|
|
1066
|
-
.describe("Suggested next action: use onchain_transaction to verify a specific past tx, " +
|
|
1067
|
-
"or proceed with onchain_operations to modify state, or re-call assemble_context " +
|
|
1068
|
-
"after state changes."),
|
|
1069
|
-
flywheel_collected: z
|
|
1070
|
-
.object({
|
|
1071
|
-
signature_recorded: z.boolean().describe("Whether the experience signature was recorded in the real-time experience layer."),
|
|
1072
|
-
proposal_created: z.boolean().describe("Whether an improvement proposal was created for the offline distillation flywheel."),
|
|
1073
|
-
proposal_id: z.string().optional().describe("The proposal ID, if created."),
|
|
1074
|
-
})
|
|
1075
|
-
.optional()
|
|
1076
|
-
.describe("Distillation flywheel collection result. Non-blocking — may be undefined if collection fails. " +
|
|
1077
|
-
"When present, the assembled context has been fed back into the experience layer and/or improvement queue."),
|
|
544
|
+
action: z.literal("generate_deployment_doc"),
|
|
545
|
+
markdown: z.string().describe("Generated deployment document markdown content (follows 71-deployment-list-spec)."),
|
|
546
|
+
validation: z.object({
|
|
547
|
+
valid: z.boolean().describe("True iff no D-check FAIL."),
|
|
548
|
+
checks: z.array(z.object({
|
|
549
|
+
check_id: z.string(),
|
|
550
|
+
description: z.string(),
|
|
551
|
+
status: z.enum(["PASS", "FAIL", "WARN"]),
|
|
552
|
+
notes: z.string().optional(),
|
|
553
|
+
}).strict()).describe("D-01..D-18 check results."),
|
|
554
|
+
errors: z.array(z.string()).describe("List of FAIL error messages."),
|
|
555
|
+
}).strict().describe("Deployment doc validation result against D-01..D-18."),
|
|
556
|
+
saved: z.boolean().describe("Whether the markdown was persisted to SQLite project_documents table."),
|
|
1078
557
|
})
|
|
1079
558
|
.strict();
|
|
1080
559
|
export const ProjectOperationOutputSchema = z
|
|
1081
560
|
.object({
|
|
1082
561
|
result: z.discriminatedUnion("action", [
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
}),
|
|
1101
|
-
z.object({
|
|
1102
|
-
action: z.literal("save_graph"),
|
|
1103
|
-
saved: z.literal(true).describe("Always true — confirms the graph was saved."),
|
|
1104
|
-
path: z.string().describe("Filesystem path where the graph was saved."),
|
|
1105
|
-
}),
|
|
1106
|
-
z.object({
|
|
1107
|
-
action: z.literal("load_graph"),
|
|
1108
|
-
loaded: z
|
|
1109
|
-
.boolean()
|
|
1110
|
-
.describe("Whether the graph was successfully loaded from disk."),
|
|
1111
|
-
}),
|
|
1112
|
-
AnalyzeIntentResultSchema,
|
|
1113
|
-
AggregateRisksResultSchema,
|
|
1114
|
-
GenerateDeploymentDocResultSchema,
|
|
1115
|
-
TraceSubstepsResultSchema,
|
|
1116
|
-
GetProjectStatusResultSchema,
|
|
1117
|
-
LoadProjectResultSchema,
|
|
1118
|
-
ForkProjectResultSchema,
|
|
1119
|
-
ExportProjectResultSchema,
|
|
1120
|
-
GetProjectFilesResultSchema,
|
|
1121
|
-
ValidateStageUnitResultSchema,
|
|
1122
|
-
GetStageAssessmentResultSchema,
|
|
1123
|
-
GetStageRiskPolicyResultSchema,
|
|
1124
|
-
GetDocRelationsResultSchema,
|
|
1125
|
-
UpdateDeploymentDocResultSchema,
|
|
1126
|
-
ValidateValidationChainResultSchema,
|
|
1127
|
-
ApplyImprovementResultSchema,
|
|
1128
|
-
GetImprovementQueueResultSchema,
|
|
1129
|
-
GetFlywheelConfigResultSchema,
|
|
1130
|
-
RollbackStageResultSchema,
|
|
1131
|
-
GetReversibilityResultSchema,
|
|
562
|
+
ListProjectsResultSchema,
|
|
563
|
+
CreateProjectResultSchema,
|
|
564
|
+
CreateProjectFromOnchainResultSchema,
|
|
565
|
+
UpdateProjectResultSchema,
|
|
566
|
+
GetProjectDetailResultSchema,
|
|
567
|
+
AddObjectResultSchema,
|
|
568
|
+
RemoveObjectResultSchema,
|
|
569
|
+
UpdateObjectResultSchema,
|
|
570
|
+
CreateVersionResultSchema,
|
|
571
|
+
BuildGraphResultSchema,
|
|
572
|
+
GetGraphResultSchema,
|
|
573
|
+
EvaluateProjectResultSchema,
|
|
574
|
+
SaveEvaluationResultSchema,
|
|
575
|
+
CompareProjectsResultSchema,
|
|
576
|
+
RefreshObjectsResultSchema,
|
|
577
|
+
GetObjectDiffResultSchema,
|
|
578
|
+
DeleteProjectResultSchema,
|
|
1132
579
|
AssembleContextResultSchema,
|
|
580
|
+
GenerateDeploymentDocResultSchema,
|
|
1133
581
|
]).describe("Query result — shape depends on action"),
|
|
1134
582
|
})
|
|
1135
583
|
.strict();
|