@planningo/duul 1.0.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/LICENSE +21 -0
- package/README.ko.md +438 -0
- package/README.md +463 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +18 -0
- package/build/prompts/code-review-system.d.ts +9 -0
- package/build/prompts/code-review-system.js +116 -0
- package/build/prompts/execution-partition-system.d.ts +11 -0
- package/build/prompts/execution-partition-system.js +76 -0
- package/build/prompts/plan-review-system.d.ts +29 -0
- package/build/prompts/plan-review-system.js +175 -0
- package/build/schemas/code-review.d.ts +514 -0
- package/build/schemas/code-review.js +175 -0
- package/build/schemas/common.d.ts +118 -0
- package/build/schemas/common.js +64 -0
- package/build/schemas/execution-partition.d.ts +597 -0
- package/build/schemas/execution-partition.js +107 -0
- package/build/schemas/plan-review.d.ts +523 -0
- package/build/schemas/plan-review.js +175 -0
- package/build/services/filesystem-tools.d.ts +6 -0
- package/build/services/filesystem-tools.js +39 -0
- package/build/services/filesystem.d.ts +69 -0
- package/build/services/filesystem.js +609 -0
- package/build/services/pricing.d.ts +8 -0
- package/build/services/pricing.js +105 -0
- package/build/services/providers/anthropic.d.ts +28 -0
- package/build/services/providers/anthropic.js +431 -0
- package/build/services/providers/google.d.ts +28 -0
- package/build/services/providers/google.js +358 -0
- package/build/services/providers/openai.d.ts +22 -0
- package/build/services/providers/openai.js +395 -0
- package/build/services/providers/types.d.ts +82 -0
- package/build/services/providers/types.js +1 -0
- package/build/services/review-gates.d.ts +83 -0
- package/build/services/review-gates.js +200 -0
- package/build/services/review-limits.d.ts +36 -0
- package/build/services/review-limits.js +65 -0
- package/build/services/reviewer.d.ts +30 -0
- package/build/services/reviewer.js +243 -0
- package/build/services/usage-logger.d.ts +2 -0
- package/build/services/usage-logger.js +42 -0
- package/build/tools/code-review.d.ts +2 -0
- package/build/tools/code-review.js +178 -0
- package/build/tools/execution-partition.d.ts +2 -0
- package/build/tools/execution-partition.js +146 -0
- package/build/tools/plan-review.d.ts +2 -0
- package/build/tools/plan-review.js +183 -0
- package/package.json +65 -0
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const DependenciesSchema: z.ZodObject<{
|
|
3
|
+
runtime: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
4
|
+
dev: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
5
|
+
}, "strip", z.ZodTypeAny, {
|
|
6
|
+
runtime?: Record<string, string> | undefined;
|
|
7
|
+
dev?: Record<string, string> | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
runtime?: Record<string, string> | undefined;
|
|
10
|
+
dev?: Record<string, string> | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const CodeReviewInputSchema: z.ZodObject<{
|
|
13
|
+
code: z.ZodString;
|
|
14
|
+
approved_plan: z.ZodString;
|
|
15
|
+
file_path: z.ZodOptional<z.ZodString>;
|
|
16
|
+
dependencies: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
runtime: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
18
|
+
dev: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
runtime?: Record<string, string> | undefined;
|
|
21
|
+
dev?: Record<string, string> | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
runtime?: Record<string, string> | undefined;
|
|
24
|
+
dev?: Record<string, string> | undefined;
|
|
25
|
+
}>>;
|
|
26
|
+
relevant_code: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
27
|
+
file_path: z.ZodString;
|
|
28
|
+
code: z.ZodString;
|
|
29
|
+
}, "strip", z.ZodTypeAny, {
|
|
30
|
+
code: string;
|
|
31
|
+
file_path: string;
|
|
32
|
+
}, {
|
|
33
|
+
code: string;
|
|
34
|
+
file_path: string;
|
|
35
|
+
}>, "many">>;
|
|
36
|
+
notes_to_reviewer: z.ZodOptional<z.ZodString>;
|
|
37
|
+
user_original_request: z.ZodOptional<z.ZodString>;
|
|
38
|
+
workspace_root: z.ZodOptional<z.ZodString>;
|
|
39
|
+
project_root: z.ZodOptional<z.ZodString>;
|
|
40
|
+
working_directories: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
41
|
+
linked_roots: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
42
|
+
changed_files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
43
|
+
entrypoints: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
44
|
+
artifact_refs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
45
|
+
path: z.ZodString;
|
|
46
|
+
reason: z.ZodString;
|
|
47
|
+
priority: z.ZodEnum<["high", "medium", "low"]>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
path: string;
|
|
50
|
+
reason: string;
|
|
51
|
+
priority: "high" | "medium" | "low";
|
|
52
|
+
}, {
|
|
53
|
+
path: string;
|
|
54
|
+
reason: string;
|
|
55
|
+
priority: "high" | "medium" | "low";
|
|
56
|
+
}>, "many">>;
|
|
57
|
+
tracked_only: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
git_head_sha: z.ZodOptional<z.ZodString>;
|
|
59
|
+
previous_git_head_sha: z.ZodOptional<z.ZodString>;
|
|
60
|
+
workspace_name: z.ZodOptional<z.ZodString>;
|
|
61
|
+
setup_script_present: z.ZodOptional<z.ZodBoolean>;
|
|
62
|
+
run_script_present: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
environment_files_expected: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
64
|
+
git_diff: z.ZodOptional<z.ZodString>;
|
|
65
|
+
git_diff_base: z.ZodOptional<z.ZodString>;
|
|
66
|
+
previous_review_id: z.ZodOptional<z.ZodString>;
|
|
67
|
+
iteration_count: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
max_review_iterations: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
reviewer_config: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
provider: z.ZodOptional<z.ZodEnum<["openai", "anthropic", "google", "openrouter", "compatible"]>>;
|
|
71
|
+
model: z.ZodOptional<z.ZodString>;
|
|
72
|
+
base_url: z.ZodOptional<z.ZodString>;
|
|
73
|
+
api_key: z.ZodOptional<z.ZodString>;
|
|
74
|
+
temperature: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
top_p: z.ZodOptional<z.ZodNumber>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
provider?: "openai" | "anthropic" | "google" | "openrouter" | "compatible" | undefined;
|
|
78
|
+
model?: string | undefined;
|
|
79
|
+
base_url?: string | undefined;
|
|
80
|
+
api_key?: string | undefined;
|
|
81
|
+
temperature?: number | undefined;
|
|
82
|
+
top_p?: number | undefined;
|
|
83
|
+
}, {
|
|
84
|
+
provider?: "openai" | "anthropic" | "google" | "openrouter" | "compatible" | undefined;
|
|
85
|
+
model?: string | undefined;
|
|
86
|
+
base_url?: string | undefined;
|
|
87
|
+
api_key?: string | undefined;
|
|
88
|
+
temperature?: number | undefined;
|
|
89
|
+
top_p?: number | undefined;
|
|
90
|
+
}>>;
|
|
91
|
+
}, "strip", z.ZodTypeAny, {
|
|
92
|
+
code: string;
|
|
93
|
+
approved_plan: string;
|
|
94
|
+
iteration_count?: number | undefined;
|
|
95
|
+
changed_files?: string[] | undefined;
|
|
96
|
+
file_path?: string | undefined;
|
|
97
|
+
relevant_code?: {
|
|
98
|
+
code: string;
|
|
99
|
+
file_path: string;
|
|
100
|
+
}[] | undefined;
|
|
101
|
+
notes_to_reviewer?: string | undefined;
|
|
102
|
+
user_original_request?: string | undefined;
|
|
103
|
+
workspace_root?: string | undefined;
|
|
104
|
+
project_root?: string | undefined;
|
|
105
|
+
working_directories?: string[] | undefined;
|
|
106
|
+
linked_roots?: string[] | undefined;
|
|
107
|
+
entrypoints?: string[] | undefined;
|
|
108
|
+
artifact_refs?: {
|
|
109
|
+
path: string;
|
|
110
|
+
reason: string;
|
|
111
|
+
priority: "high" | "medium" | "low";
|
|
112
|
+
}[] | undefined;
|
|
113
|
+
tracked_only?: boolean | undefined;
|
|
114
|
+
git_head_sha?: string | undefined;
|
|
115
|
+
previous_git_head_sha?: string | undefined;
|
|
116
|
+
workspace_name?: string | undefined;
|
|
117
|
+
setup_script_present?: boolean | undefined;
|
|
118
|
+
run_script_present?: boolean | undefined;
|
|
119
|
+
environment_files_expected?: string[] | undefined;
|
|
120
|
+
git_diff?: string | undefined;
|
|
121
|
+
git_diff_base?: string | undefined;
|
|
122
|
+
previous_review_id?: string | undefined;
|
|
123
|
+
max_review_iterations?: number | undefined;
|
|
124
|
+
reviewer_config?: {
|
|
125
|
+
provider?: "openai" | "anthropic" | "google" | "openrouter" | "compatible" | undefined;
|
|
126
|
+
model?: string | undefined;
|
|
127
|
+
base_url?: string | undefined;
|
|
128
|
+
api_key?: string | undefined;
|
|
129
|
+
temperature?: number | undefined;
|
|
130
|
+
top_p?: number | undefined;
|
|
131
|
+
} | undefined;
|
|
132
|
+
dependencies?: {
|
|
133
|
+
runtime?: Record<string, string> | undefined;
|
|
134
|
+
dev?: Record<string, string> | undefined;
|
|
135
|
+
} | undefined;
|
|
136
|
+
}, {
|
|
137
|
+
code: string;
|
|
138
|
+
approved_plan: string;
|
|
139
|
+
iteration_count?: number | undefined;
|
|
140
|
+
changed_files?: string[] | undefined;
|
|
141
|
+
file_path?: string | undefined;
|
|
142
|
+
relevant_code?: {
|
|
143
|
+
code: string;
|
|
144
|
+
file_path: string;
|
|
145
|
+
}[] | undefined;
|
|
146
|
+
notes_to_reviewer?: string | undefined;
|
|
147
|
+
user_original_request?: string | undefined;
|
|
148
|
+
workspace_root?: string | undefined;
|
|
149
|
+
project_root?: string | undefined;
|
|
150
|
+
working_directories?: string[] | undefined;
|
|
151
|
+
linked_roots?: string[] | undefined;
|
|
152
|
+
entrypoints?: string[] | undefined;
|
|
153
|
+
artifact_refs?: {
|
|
154
|
+
path: string;
|
|
155
|
+
reason: string;
|
|
156
|
+
priority: "high" | "medium" | "low";
|
|
157
|
+
}[] | undefined;
|
|
158
|
+
tracked_only?: boolean | undefined;
|
|
159
|
+
git_head_sha?: string | undefined;
|
|
160
|
+
previous_git_head_sha?: string | undefined;
|
|
161
|
+
workspace_name?: string | undefined;
|
|
162
|
+
setup_script_present?: boolean | undefined;
|
|
163
|
+
run_script_present?: boolean | undefined;
|
|
164
|
+
environment_files_expected?: string[] | undefined;
|
|
165
|
+
git_diff?: string | undefined;
|
|
166
|
+
git_diff_base?: string | undefined;
|
|
167
|
+
previous_review_id?: string | undefined;
|
|
168
|
+
max_review_iterations?: number | undefined;
|
|
169
|
+
reviewer_config?: {
|
|
170
|
+
provider?: "openai" | "anthropic" | "google" | "openrouter" | "compatible" | undefined;
|
|
171
|
+
model?: string | undefined;
|
|
172
|
+
base_url?: string | undefined;
|
|
173
|
+
api_key?: string | undefined;
|
|
174
|
+
temperature?: number | undefined;
|
|
175
|
+
top_p?: number | undefined;
|
|
176
|
+
} | undefined;
|
|
177
|
+
dependencies?: {
|
|
178
|
+
runtime?: Record<string, string> | undefined;
|
|
179
|
+
dev?: Record<string, string> | undefined;
|
|
180
|
+
} | undefined;
|
|
181
|
+
}>;
|
|
182
|
+
export declare const CodeReviewOutputSchema: z.ZodObject<{
|
|
183
|
+
verdict: z.ZodEnum<["APPROVE", "REVISE"]>;
|
|
184
|
+
review_status: z.ZodEnum<["completed", "incomplete"]>;
|
|
185
|
+
confidence: z.ZodNumber;
|
|
186
|
+
requires_human_review: z.ZodBoolean;
|
|
187
|
+
logic_validation: z.ZodString;
|
|
188
|
+
blocking_issues: z.ZodArray<z.ZodObject<{
|
|
189
|
+
description: z.ZodString;
|
|
190
|
+
suggestion: z.ZodString;
|
|
191
|
+
}, "strip", z.ZodTypeAny, {
|
|
192
|
+
description: string;
|
|
193
|
+
suggestion: string;
|
|
194
|
+
}, {
|
|
195
|
+
description: string;
|
|
196
|
+
suggestion: string;
|
|
197
|
+
}>, "many">;
|
|
198
|
+
merge_blockers: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
199
|
+
description: z.ZodString;
|
|
200
|
+
suggestion: z.ZodString;
|
|
201
|
+
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
description: string;
|
|
203
|
+
suggestion: string;
|
|
204
|
+
}, {
|
|
205
|
+
description: string;
|
|
206
|
+
suggestion: string;
|
|
207
|
+
}>, "many">>;
|
|
208
|
+
non_blocking_suggestions: z.ZodArray<z.ZodString, "many">;
|
|
209
|
+
vulnerabilities: z.ZodArray<z.ZodObject<{
|
|
210
|
+
type: z.ZodString;
|
|
211
|
+
description: z.ZodString;
|
|
212
|
+
severity: z.ZodEnum<["critical", "high", "medium"]>;
|
|
213
|
+
}, "strip", z.ZodTypeAny, {
|
|
214
|
+
type: string;
|
|
215
|
+
description: string;
|
|
216
|
+
severity: "high" | "medium" | "critical";
|
|
217
|
+
}, {
|
|
218
|
+
type: string;
|
|
219
|
+
description: string;
|
|
220
|
+
severity: "high" | "medium" | "critical";
|
|
221
|
+
}>, "many">;
|
|
222
|
+
optimized_snippet: z.ZodNullable<z.ZodString>;
|
|
223
|
+
follow_up_todos: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
224
|
+
missing_context: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
225
|
+
evidence_files: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
226
|
+
used_tools: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
227
|
+
tool_exhaustion_reason: z.ZodNullable<z.ZodEnum<["budget", "repeat", "round_limit"]>>;
|
|
228
|
+
user_original_request_echo: z.ZodNullable<z.ZodString>;
|
|
229
|
+
symptom_impact: z.ZodNullable<z.ZodObject<{
|
|
230
|
+
before: z.ZodString;
|
|
231
|
+
after: z.ZodString;
|
|
232
|
+
causal_chain: z.ZodString;
|
|
233
|
+
}, "strip", z.ZodTypeAny, {
|
|
234
|
+
before: string;
|
|
235
|
+
after: string;
|
|
236
|
+
causal_chain: string;
|
|
237
|
+
}, {
|
|
238
|
+
before: string;
|
|
239
|
+
after: string;
|
|
240
|
+
causal_chain: string;
|
|
241
|
+
}>>;
|
|
242
|
+
symptom_match_notes: z.ZodNullable<z.ZodString>;
|
|
243
|
+
gates_tripped: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
244
|
+
}, "strip", z.ZodTypeAny, {
|
|
245
|
+
verdict: "APPROVE" | "REVISE";
|
|
246
|
+
review_status: "completed" | "incomplete";
|
|
247
|
+
confidence: number;
|
|
248
|
+
requires_human_review: boolean;
|
|
249
|
+
blocking_issues: {
|
|
250
|
+
description: string;
|
|
251
|
+
suggestion: string;
|
|
252
|
+
}[];
|
|
253
|
+
merge_blockers: {
|
|
254
|
+
description: string;
|
|
255
|
+
suggestion: string;
|
|
256
|
+
}[] | null;
|
|
257
|
+
non_blocking_suggestions: string[];
|
|
258
|
+
follow_up_todos: string[] | null;
|
|
259
|
+
missing_context: string[] | null;
|
|
260
|
+
evidence_files: string[] | null;
|
|
261
|
+
used_tools: string[] | null;
|
|
262
|
+
tool_exhaustion_reason: "budget" | "repeat" | "round_limit" | null;
|
|
263
|
+
user_original_request_echo: string | null;
|
|
264
|
+
symptom_impact: {
|
|
265
|
+
before: string;
|
|
266
|
+
after: string;
|
|
267
|
+
causal_chain: string;
|
|
268
|
+
} | null;
|
|
269
|
+
symptom_match_notes: string | null;
|
|
270
|
+
gates_tripped: string[] | null;
|
|
271
|
+
logic_validation: string;
|
|
272
|
+
vulnerabilities: {
|
|
273
|
+
type: string;
|
|
274
|
+
description: string;
|
|
275
|
+
severity: "high" | "medium" | "critical";
|
|
276
|
+
}[];
|
|
277
|
+
optimized_snippet: string | null;
|
|
278
|
+
}, {
|
|
279
|
+
verdict: "APPROVE" | "REVISE";
|
|
280
|
+
review_status: "completed" | "incomplete";
|
|
281
|
+
confidence: number;
|
|
282
|
+
requires_human_review: boolean;
|
|
283
|
+
blocking_issues: {
|
|
284
|
+
description: string;
|
|
285
|
+
suggestion: string;
|
|
286
|
+
}[];
|
|
287
|
+
merge_blockers: {
|
|
288
|
+
description: string;
|
|
289
|
+
suggestion: string;
|
|
290
|
+
}[] | null;
|
|
291
|
+
non_blocking_suggestions: string[];
|
|
292
|
+
follow_up_todos: string[] | null;
|
|
293
|
+
missing_context: string[] | null;
|
|
294
|
+
evidence_files: string[] | null;
|
|
295
|
+
used_tools: string[] | null;
|
|
296
|
+
tool_exhaustion_reason: "budget" | "repeat" | "round_limit" | null;
|
|
297
|
+
user_original_request_echo: string | null;
|
|
298
|
+
symptom_impact: {
|
|
299
|
+
before: string;
|
|
300
|
+
after: string;
|
|
301
|
+
causal_chain: string;
|
|
302
|
+
} | null;
|
|
303
|
+
symptom_match_notes: string | null;
|
|
304
|
+
gates_tripped: string[] | null;
|
|
305
|
+
logic_validation: string;
|
|
306
|
+
vulnerabilities: {
|
|
307
|
+
type: string;
|
|
308
|
+
description: string;
|
|
309
|
+
severity: "high" | "medium" | "critical";
|
|
310
|
+
}[];
|
|
311
|
+
optimized_snippet: string | null;
|
|
312
|
+
}>;
|
|
313
|
+
export declare const CodeReviewMcpOutputSchema: z.ZodObject<{
|
|
314
|
+
verdict: z.ZodEnum<["APPROVE", "REVISE"]>;
|
|
315
|
+
review_status: z.ZodEnum<["completed", "incomplete"]>;
|
|
316
|
+
confidence: z.ZodNumber;
|
|
317
|
+
requires_human_review: z.ZodBoolean;
|
|
318
|
+
logic_validation: z.ZodString;
|
|
319
|
+
blocking_issues: z.ZodArray<z.ZodObject<{
|
|
320
|
+
description: z.ZodString;
|
|
321
|
+
suggestion: z.ZodString;
|
|
322
|
+
}, "strip", z.ZodTypeAny, {
|
|
323
|
+
description: string;
|
|
324
|
+
suggestion: string;
|
|
325
|
+
}, {
|
|
326
|
+
description: string;
|
|
327
|
+
suggestion: string;
|
|
328
|
+
}>, "many">;
|
|
329
|
+
merge_blockers: z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
330
|
+
description: z.ZodString;
|
|
331
|
+
suggestion: z.ZodString;
|
|
332
|
+
}, "strip", z.ZodTypeAny, {
|
|
333
|
+
description: string;
|
|
334
|
+
suggestion: string;
|
|
335
|
+
}, {
|
|
336
|
+
description: string;
|
|
337
|
+
suggestion: string;
|
|
338
|
+
}>, "many">>;
|
|
339
|
+
non_blocking_suggestions: z.ZodArray<z.ZodString, "many">;
|
|
340
|
+
vulnerabilities: z.ZodArray<z.ZodObject<{
|
|
341
|
+
type: z.ZodString;
|
|
342
|
+
description: z.ZodString;
|
|
343
|
+
severity: z.ZodEnum<["critical", "high", "medium"]>;
|
|
344
|
+
}, "strip", z.ZodTypeAny, {
|
|
345
|
+
type: string;
|
|
346
|
+
description: string;
|
|
347
|
+
severity: "high" | "medium" | "critical";
|
|
348
|
+
}, {
|
|
349
|
+
type: string;
|
|
350
|
+
description: string;
|
|
351
|
+
severity: "high" | "medium" | "critical";
|
|
352
|
+
}>, "many">;
|
|
353
|
+
optimized_snippet: z.ZodNullable<z.ZodString>;
|
|
354
|
+
follow_up_todos: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
355
|
+
missing_context: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
356
|
+
evidence_files: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
357
|
+
used_tools: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
358
|
+
tool_exhaustion_reason: z.ZodNullable<z.ZodEnum<["budget", "repeat", "round_limit"]>>;
|
|
359
|
+
user_original_request_echo: z.ZodNullable<z.ZodString>;
|
|
360
|
+
symptom_impact: z.ZodNullable<z.ZodObject<{
|
|
361
|
+
before: z.ZodString;
|
|
362
|
+
after: z.ZodString;
|
|
363
|
+
causal_chain: z.ZodString;
|
|
364
|
+
}, "strip", z.ZodTypeAny, {
|
|
365
|
+
before: string;
|
|
366
|
+
after: string;
|
|
367
|
+
causal_chain: string;
|
|
368
|
+
}, {
|
|
369
|
+
before: string;
|
|
370
|
+
after: string;
|
|
371
|
+
causal_chain: string;
|
|
372
|
+
}>>;
|
|
373
|
+
symptom_match_notes: z.ZodNullable<z.ZodString>;
|
|
374
|
+
gates_tripped: z.ZodNullable<z.ZodArray<z.ZodString, "many">>;
|
|
375
|
+
} & {
|
|
376
|
+
review_id: z.ZodString;
|
|
377
|
+
} & {
|
|
378
|
+
iteration_count: z.ZodNumber;
|
|
379
|
+
iteration_limit: z.ZodNumber;
|
|
380
|
+
iteration_limit_reached: z.ZodBoolean;
|
|
381
|
+
} & {
|
|
382
|
+
token_usage: z.ZodObject<{
|
|
383
|
+
input_tokens: z.ZodNumber;
|
|
384
|
+
output_tokens: z.ZodNumber;
|
|
385
|
+
total_tokens: z.ZodNumber;
|
|
386
|
+
api_calls: z.ZodNumber;
|
|
387
|
+
provider: z.ZodString;
|
|
388
|
+
model: z.ZodString;
|
|
389
|
+
estimated_cost_usd: z.ZodNullable<z.ZodNumber>;
|
|
390
|
+
cached_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
391
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
392
|
+
}, "strip", z.ZodTypeAny, {
|
|
393
|
+
provider: string;
|
|
394
|
+
model: string;
|
|
395
|
+
input_tokens: number;
|
|
396
|
+
output_tokens: number;
|
|
397
|
+
total_tokens: number;
|
|
398
|
+
api_calls: number;
|
|
399
|
+
estimated_cost_usd: number | null;
|
|
400
|
+
cached_input_tokens?: number | undefined;
|
|
401
|
+
cache_creation_input_tokens?: number | undefined;
|
|
402
|
+
}, {
|
|
403
|
+
provider: string;
|
|
404
|
+
model: string;
|
|
405
|
+
input_tokens: number;
|
|
406
|
+
output_tokens: number;
|
|
407
|
+
total_tokens: number;
|
|
408
|
+
api_calls: number;
|
|
409
|
+
estimated_cost_usd: number | null;
|
|
410
|
+
cached_input_tokens?: number | undefined;
|
|
411
|
+
cache_creation_input_tokens?: number | undefined;
|
|
412
|
+
}>;
|
|
413
|
+
}, "strip", z.ZodTypeAny, {
|
|
414
|
+
iteration_count: number;
|
|
415
|
+
iteration_limit: number;
|
|
416
|
+
iteration_limit_reached: boolean;
|
|
417
|
+
token_usage: {
|
|
418
|
+
provider: string;
|
|
419
|
+
model: string;
|
|
420
|
+
input_tokens: number;
|
|
421
|
+
output_tokens: number;
|
|
422
|
+
total_tokens: number;
|
|
423
|
+
api_calls: number;
|
|
424
|
+
estimated_cost_usd: number | null;
|
|
425
|
+
cached_input_tokens?: number | undefined;
|
|
426
|
+
cache_creation_input_tokens?: number | undefined;
|
|
427
|
+
};
|
|
428
|
+
verdict: "APPROVE" | "REVISE";
|
|
429
|
+
review_status: "completed" | "incomplete";
|
|
430
|
+
confidence: number;
|
|
431
|
+
requires_human_review: boolean;
|
|
432
|
+
blocking_issues: {
|
|
433
|
+
description: string;
|
|
434
|
+
suggestion: string;
|
|
435
|
+
}[];
|
|
436
|
+
merge_blockers: {
|
|
437
|
+
description: string;
|
|
438
|
+
suggestion: string;
|
|
439
|
+
}[] | null;
|
|
440
|
+
non_blocking_suggestions: string[];
|
|
441
|
+
follow_up_todos: string[] | null;
|
|
442
|
+
missing_context: string[] | null;
|
|
443
|
+
evidence_files: string[] | null;
|
|
444
|
+
used_tools: string[] | null;
|
|
445
|
+
tool_exhaustion_reason: "budget" | "repeat" | "round_limit" | null;
|
|
446
|
+
user_original_request_echo: string | null;
|
|
447
|
+
symptom_impact: {
|
|
448
|
+
before: string;
|
|
449
|
+
after: string;
|
|
450
|
+
causal_chain: string;
|
|
451
|
+
} | null;
|
|
452
|
+
symptom_match_notes: string | null;
|
|
453
|
+
gates_tripped: string[] | null;
|
|
454
|
+
review_id: string;
|
|
455
|
+
logic_validation: string;
|
|
456
|
+
vulnerabilities: {
|
|
457
|
+
type: string;
|
|
458
|
+
description: string;
|
|
459
|
+
severity: "high" | "medium" | "critical";
|
|
460
|
+
}[];
|
|
461
|
+
optimized_snippet: string | null;
|
|
462
|
+
}, {
|
|
463
|
+
iteration_count: number;
|
|
464
|
+
iteration_limit: number;
|
|
465
|
+
iteration_limit_reached: boolean;
|
|
466
|
+
token_usage: {
|
|
467
|
+
provider: string;
|
|
468
|
+
model: string;
|
|
469
|
+
input_tokens: number;
|
|
470
|
+
output_tokens: number;
|
|
471
|
+
total_tokens: number;
|
|
472
|
+
api_calls: number;
|
|
473
|
+
estimated_cost_usd: number | null;
|
|
474
|
+
cached_input_tokens?: number | undefined;
|
|
475
|
+
cache_creation_input_tokens?: number | undefined;
|
|
476
|
+
};
|
|
477
|
+
verdict: "APPROVE" | "REVISE";
|
|
478
|
+
review_status: "completed" | "incomplete";
|
|
479
|
+
confidence: number;
|
|
480
|
+
requires_human_review: boolean;
|
|
481
|
+
blocking_issues: {
|
|
482
|
+
description: string;
|
|
483
|
+
suggestion: string;
|
|
484
|
+
}[];
|
|
485
|
+
merge_blockers: {
|
|
486
|
+
description: string;
|
|
487
|
+
suggestion: string;
|
|
488
|
+
}[] | null;
|
|
489
|
+
non_blocking_suggestions: string[];
|
|
490
|
+
follow_up_todos: string[] | null;
|
|
491
|
+
missing_context: string[] | null;
|
|
492
|
+
evidence_files: string[] | null;
|
|
493
|
+
used_tools: string[] | null;
|
|
494
|
+
tool_exhaustion_reason: "budget" | "repeat" | "round_limit" | null;
|
|
495
|
+
user_original_request_echo: string | null;
|
|
496
|
+
symptom_impact: {
|
|
497
|
+
before: string;
|
|
498
|
+
after: string;
|
|
499
|
+
causal_chain: string;
|
|
500
|
+
} | null;
|
|
501
|
+
symptom_match_notes: string | null;
|
|
502
|
+
gates_tripped: string[] | null;
|
|
503
|
+
review_id: string;
|
|
504
|
+
logic_validation: string;
|
|
505
|
+
vulnerabilities: {
|
|
506
|
+
type: string;
|
|
507
|
+
description: string;
|
|
508
|
+
severity: "high" | "medium" | "critical";
|
|
509
|
+
}[];
|
|
510
|
+
optimized_snippet: string | null;
|
|
511
|
+
}>;
|
|
512
|
+
export type CodeReviewInput = z.infer<typeof CodeReviewInputSchema>;
|
|
513
|
+
export type CodeReviewOutput = z.infer<typeof CodeReviewOutputSchema>;
|
|
514
|
+
export type CodeReviewMcpOutput = z.infer<typeof CodeReviewMcpOutputSchema>;
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ArtifactRefSchema, ReviewerConfigSchema, IterationMetaOutputSchema, TokenUsageOutputSchema } from './common.js';
|
|
3
|
+
export const DependenciesSchema = z.object({
|
|
4
|
+
runtime: z
|
|
5
|
+
.record(z.string(), z.string())
|
|
6
|
+
.optional()
|
|
7
|
+
.describe('Runtime package versions, e.g. { "express": "4.18.2" }'),
|
|
8
|
+
dev: z
|
|
9
|
+
.record(z.string(), z.string())
|
|
10
|
+
.optional()
|
|
11
|
+
.describe('Dev dependency versions, e.g. { "typescript": "5.8.0" }'),
|
|
12
|
+
});
|
|
13
|
+
export const CodeReviewInputSchema = z.object({
|
|
14
|
+
code: z.string().min(1, 'code must not be empty').describe('The code to review'),
|
|
15
|
+
approved_plan: z
|
|
16
|
+
.string()
|
|
17
|
+
.min(1, 'approved_plan must not be empty')
|
|
18
|
+
.describe('The previously approved plan this code implements'),
|
|
19
|
+
file_path: z.string().optional().describe('File path for contextual feedback'),
|
|
20
|
+
dependencies: DependenciesSchema.optional().describe('Related library version info'),
|
|
21
|
+
relevant_code: z
|
|
22
|
+
.array(z.object({
|
|
23
|
+
file_path: z.string().describe('File path'),
|
|
24
|
+
code: z.string().describe('Relevant code snippet (types, interfaces, functions, classes)'),
|
|
25
|
+
}))
|
|
26
|
+
.optional()
|
|
27
|
+
.describe('Related code snippets the reviewer should see for full context. ' +
|
|
28
|
+
'Include type definitions, data models, and surrounding code that the reviewed code depends on.'),
|
|
29
|
+
notes_to_reviewer: z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe('Context or rebuttals from the caller to the reviewer. ' +
|
|
33
|
+
'Use this to explain codebase-specific facts the reviewer cannot see, ' +
|
|
34
|
+
'or to respond to blocking issues from a previous round.'),
|
|
35
|
+
user_original_request: z
|
|
36
|
+
.string()
|
|
37
|
+
.max(4000)
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("The user's original, unedited problem statement (not paraphrased by the caller). " +
|
|
40
|
+
'Used by the reviewer to verify the code actually makes the reported symptom go away.'),
|
|
41
|
+
// --- Workspace-aware scope fields ---
|
|
42
|
+
workspace_root: z
|
|
43
|
+
.string()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe('Absolute path to the workspace root directory. Preferred over project_root. ' +
|
|
46
|
+
'When provided, the reviewer gains file exploration tools scoped to this workspace.'),
|
|
47
|
+
project_root: z
|
|
48
|
+
.string()
|
|
49
|
+
.optional()
|
|
50
|
+
.describe('[DEPRECATED — use workspace_root] Absolute path to the project root directory. ' +
|
|
51
|
+
'Used as fallback when workspace_root is not provided.'),
|
|
52
|
+
working_directories: z
|
|
53
|
+
.array(z.string())
|
|
54
|
+
.optional()
|
|
55
|
+
.describe('Subdirectories within workspace_root to restrict file access to. ' +
|
|
56
|
+
'Acts as a sparse-checkout-like allowlist. If omitted, entire workspace_root is accessible.'),
|
|
57
|
+
linked_roots: z
|
|
58
|
+
.array(z.string())
|
|
59
|
+
.max(5)
|
|
60
|
+
.optional()
|
|
61
|
+
.describe('Additional read-only workspace roots the reviewer can access. ' +
|
|
62
|
+
'Each must be a valid absolute path (3+ depth). Max 5.'),
|
|
63
|
+
changed_files: z
|
|
64
|
+
.array(z.string())
|
|
65
|
+
.optional()
|
|
66
|
+
.describe('Files changed in this review scope (top-level, separate from project_context)'),
|
|
67
|
+
entrypoints: z
|
|
68
|
+
.array(z.string())
|
|
69
|
+
.optional()
|
|
70
|
+
.describe('Entry point files the reviewer should start from'),
|
|
71
|
+
artifact_refs: z
|
|
72
|
+
.array(ArtifactRefSchema)
|
|
73
|
+
.max(30)
|
|
74
|
+
.optional()
|
|
75
|
+
.describe('References to important files with reason and priority. Max 30.'),
|
|
76
|
+
tracked_only: z
|
|
77
|
+
.boolean()
|
|
78
|
+
.optional()
|
|
79
|
+
.describe('When true, only git-tracked files are accessible to the reviewer.'),
|
|
80
|
+
// --- Git metadata ---
|
|
81
|
+
git_head_sha: z.string().optional().describe('Current git HEAD SHA for this review'),
|
|
82
|
+
previous_git_head_sha: z.string().optional().describe('Git HEAD SHA from the previous review round. Used with git_head_sha to detect stale context.'),
|
|
83
|
+
workspace_name: z.string().optional().describe('Name of the workspace (for logging/identification)'),
|
|
84
|
+
// --- Setup/Run metadata ---
|
|
85
|
+
setup_script_present: z.boolean().optional().describe('Whether a setup script exists in the workspace'),
|
|
86
|
+
run_script_present: z.boolean().optional().describe('Whether a run/start script exists in the workspace'),
|
|
87
|
+
environment_files_expected: z.array(z.string()).optional().describe('Environment files expected but not tracked (e.g. [".env", ".env.local"]). Prevents false positives.'),
|
|
88
|
+
// --- Git diff ---
|
|
89
|
+
git_diff: z
|
|
90
|
+
.string()
|
|
91
|
+
.optional()
|
|
92
|
+
.describe('Pre-computed git diff to include in review context. If omitted and workspace_root + changed_files are provided, ' +
|
|
93
|
+
'the diff is auto-generated.'),
|
|
94
|
+
git_diff_base: z
|
|
95
|
+
.string()
|
|
96
|
+
.optional()
|
|
97
|
+
.describe('Base ref for auto-generated git diff (e.g. "HEAD", "main"). Default: "HEAD".'),
|
|
98
|
+
previous_review_id: z
|
|
99
|
+
.string()
|
|
100
|
+
.optional()
|
|
101
|
+
.describe('Response ID from a previous review call. Pass this to maintain reviewer context ' +
|
|
102
|
+
'across rounds and across phases — the reviewer will remember the plan review ' +
|
|
103
|
+
'conversation when doing code review.'),
|
|
104
|
+
// --- Iteration tracking ---
|
|
105
|
+
iteration_count: z
|
|
106
|
+
.number()
|
|
107
|
+
.min(1)
|
|
108
|
+
.optional()
|
|
109
|
+
.describe('Current iteration number (1-based). The caller MUST increment this on each call. ' +
|
|
110
|
+
'When this reaches the iteration limit, the server returns requires_human_review: true.'),
|
|
111
|
+
max_review_iterations: z
|
|
112
|
+
.number()
|
|
113
|
+
.min(1)
|
|
114
|
+
.max(20)
|
|
115
|
+
.optional()
|
|
116
|
+
.describe('Override the maximum iterations for this phase. Default: env MAX_CODE_REVIEW_ITERATIONS or 7.'),
|
|
117
|
+
// --- Reviewer config ---
|
|
118
|
+
reviewer_config: ReviewerConfigSchema.optional().describe('Per-request reviewer configuration. Overrides env defaults.'),
|
|
119
|
+
});
|
|
120
|
+
const BlockingIssueSchema = z.object({
|
|
121
|
+
description: z.string().describe('What the issue is'),
|
|
122
|
+
suggestion: z.string().describe('How to fix it'),
|
|
123
|
+
});
|
|
124
|
+
const VulnerabilitySchema = z.object({
|
|
125
|
+
type: z.string().describe('Vulnerability type, e.g. "SQL Injection", "Race Condition"'),
|
|
126
|
+
description: z.string().describe('Detailed description of the vulnerability'),
|
|
127
|
+
severity: z.enum(['critical', 'high', 'medium']).describe('Severity level'),
|
|
128
|
+
});
|
|
129
|
+
export const CodeReviewOutputSchema = z.object({
|
|
130
|
+
verdict: z.enum(['APPROVE', 'REVISE']).describe('Final verdict'),
|
|
131
|
+
review_status: z.enum(['completed', 'incomplete']).describe('Whether the review was fully completed. "incomplete" means the tool loop was exhausted before the reviewer could finish.'),
|
|
132
|
+
confidence: z.number().min(0).max(1).describe('Confidence in the verdict (0-1), advisory only'),
|
|
133
|
+
requires_human_review: z.boolean().describe('Whether a human should review this'),
|
|
134
|
+
logic_validation: z.string().describe('How accurately the code implements the approved plan'),
|
|
135
|
+
blocking_issues: z
|
|
136
|
+
.array(BlockingIssueSchema)
|
|
137
|
+
.describe('Issues that must be fixed before proceeding'),
|
|
138
|
+
merge_blockers: z
|
|
139
|
+
.array(BlockingIssueSchema)
|
|
140
|
+
.nullable()
|
|
141
|
+
.describe('Subset of blocking_issues that should block merge. Null if same as blocking_issues.'),
|
|
142
|
+
non_blocking_suggestions: z
|
|
143
|
+
.array(z.string())
|
|
144
|
+
.describe('Optional improvement suggestions'),
|
|
145
|
+
vulnerabilities: z
|
|
146
|
+
.array(VulnerabilitySchema)
|
|
147
|
+
.describe('Security and performance vulnerabilities found'),
|
|
148
|
+
optimized_snippet: z
|
|
149
|
+
.string()
|
|
150
|
+
.nullable()
|
|
151
|
+
.describe('Codex-suggested optimized code block, or null if not needed'),
|
|
152
|
+
follow_up_todos: z.array(z.string()).nullable().describe('Follow-up tasks after implementation'),
|
|
153
|
+
missing_context: z.array(z.string()).nullable().describe('Files or context the reviewer could not access'),
|
|
154
|
+
evidence_files: z.array(z.string()).nullable().describe('Files the reviewer examined as evidence'),
|
|
155
|
+
used_tools: z.array(z.string()).nullable().describe('Tool calls made during review'),
|
|
156
|
+
tool_exhaustion_reason: z.enum(['budget', 'repeat', 'round_limit']).nullable().describe('If review_status is incomplete, the reason why the tool loop was exhausted'),
|
|
157
|
+
user_original_request_echo: z.string().nullable().describe('Verbatim echo of user_original_request so the reviewer commits to what it was asked to solve. Null only if the caller omitted user_original_request.'),
|
|
158
|
+
symptom_impact: z
|
|
159
|
+
.object({
|
|
160
|
+
before: z.string().describe('Observable symptom the user reported, in their own terms.'),
|
|
161
|
+
after: z.string().describe('What the user observes now that this code is merged.'),
|
|
162
|
+
causal_chain: z.string().describe("Why the code change causes 'before' → 'after'."),
|
|
163
|
+
})
|
|
164
|
+
.nullable()
|
|
165
|
+
.describe('How the code changes the user-visible symptom. Null only if user_original_request was not supplied.'),
|
|
166
|
+
symptom_match_notes: z.string().nullable().describe('If code does NOT clearly address the reported symptom, explain the gap here. Null if fully addressed.'),
|
|
167
|
+
gates_tripped: z.array(z.string()).nullable().describe('Server-populated list of post-LLM gate names that fired. Reviewer should leave null.'),
|
|
168
|
+
});
|
|
169
|
+
// Extended output with server-added fields (not sent to the reviewer model, used for MCP response)
|
|
170
|
+
export const CodeReviewMcpOutputSchema = CodeReviewOutputSchema
|
|
171
|
+
.extend({
|
|
172
|
+
review_id: z.string().describe('Response ID for maintaining reviewer context across rounds. Pass as previous_review_id on the next call.'),
|
|
173
|
+
})
|
|
174
|
+
.merge(IterationMetaOutputSchema)
|
|
175
|
+
.merge(TokenUsageOutputSchema);
|