clud-bug 0.7.0-rc.1 → 0.7.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/index.d.ts +4 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +18 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/prompt-builder.d.ts +164 -0
- package/dist/core/prompt-builder.d.ts.map +1 -0
- package/dist/core/prompt-builder.js +419 -0
- package/dist/core/prompt-builder.js.map +1 -0
- package/dist/core/review-schema-zod.d.ts +240 -0
- package/dist/core/review-schema-zod.d.ts.map +1 -0
- package/dist/core/review-schema-zod.js +218 -0
- package/dist/core/review-schema-zod.js.map +1 -0
- package/dist/core/review-writeback.d.ts +139 -0
- package/dist/core/review-writeback.d.ts.map +1 -0
- package/dist/core/review-writeback.js +313 -0
- package/dist/core/review-writeback.js.map +1 -0
- package/dist/core/skills.d.ts +42 -0
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +126 -0
- package/dist/core/skills.js.map +1 -1
- package/package.json +4 -1
- package/src/core/index.ts +85 -0
- package/src/core/prompt-builder.ts +561 -0
- package/src/core/review-schema-zod.ts +262 -0
- package/src/core/review-writeback.ts +446 -0
- package/src/core/skills.ts +168 -0
- package/templates/workflow-py.yml.tmpl +1 -1
- package/templates/workflow-ts.yml.tmpl +1 -1
- package/templates/workflow.yml.tmpl +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-builder.js","sourceRoot":"","sources":["../../src/core/prompt-builder.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,4EAA4E;AAC5E,qEAAqE;AACrE,0EAA0E;AAC1E,qDAAqD;AACrD,EAAE;AACF,4CAA4C;AAC5C,EAAE;AACF,YAAY;AACZ,4BAA4B;AAC5B,yDAAyD;AACzD,wEAAwE;AACxE,EAAE;AACF,UAAU;AACV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ACjC,MAAM;QACN,kBAAkB;QAClB,YAAY;KACb,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAA6B;IAChE,MAAM,KAAK,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO;QACL,GAAG,KAAK;QACR,MAAM,EAAE,uBAAuB;KAChC,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,QAAmB;IACnD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,kCAAkC,CAAC;IAC5C,CAAC;IACD,OAAO,QAAQ;SACZ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACZ,gEAAgE;QAChE,+DAA+D;QAC/D,6DAA6D;QAC7D,MAAM,SAAS,GAAG,CAAC,CAAC,IAAI,IAAI,gBAAgB,CAAC;QAC7C,MAAM,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1D,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAClE,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,OAAO,GAAG,QAAQ,CAAC,CAAC,KAAK,KAAK,CAAC,CAAC,OAAO,GAAG,MAAM,EAAE,CAAC;IAChF,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const severityValues: readonly ["critical", "minor", "preexisting"];
|
|
3
|
+
export declare const severitySchema: z.ZodEnum<{
|
|
4
|
+
critical: "critical";
|
|
5
|
+
minor: "minor";
|
|
6
|
+
preexisting: "preexisting";
|
|
7
|
+
}>;
|
|
8
|
+
export type Severity = z.infer<typeof severitySchema>;
|
|
9
|
+
export declare const statusHeaderValues: readonly ["critical findings", "clean", "bare"];
|
|
10
|
+
export declare const statusHeaderSchema: z.ZodEnum<{
|
|
11
|
+
"critical findings": "critical findings";
|
|
12
|
+
clean: "clean";
|
|
13
|
+
bare: "bare";
|
|
14
|
+
}>;
|
|
15
|
+
export type StatusHeader = z.infer<typeof statusHeaderSchema>;
|
|
16
|
+
export declare const summaryCountsSchema: z.ZodObject<{
|
|
17
|
+
critical: z.ZodNumber;
|
|
18
|
+
minor: z.ZodNumber;
|
|
19
|
+
preexisting: z.ZodNumber;
|
|
20
|
+
resolved_from_prior: z.ZodNumber;
|
|
21
|
+
still_open: z.ZodNumber;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export type SummaryCounts = z.infer<typeof summaryCountsSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Wire-shape finding item — NO severity field (mirrors the CLI's
|
|
26
|
+
* `FINDING_ITEM` JSON Schema in `./review-schema.ts`). Severity is implicit
|
|
27
|
+
* in which array the item lives in (`critical_findings`/`minor_findings`/
|
|
28
|
+
* `preexisting_findings`).
|
|
29
|
+
*/
|
|
30
|
+
export declare const findingItemSchema: z.ZodObject<{
|
|
31
|
+
skill: z.ZodString;
|
|
32
|
+
file: z.ZodOptional<z.ZodString>;
|
|
33
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
summary: z.ZodString;
|
|
35
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
export type FindingItem = z.infer<typeof findingItemSchema>;
|
|
38
|
+
/** Per-skill scan report — one entry per loaded skill (even silent ones). */
|
|
39
|
+
export declare const perSkillScanItemSchema: z.ZodObject<{
|
|
40
|
+
skill: z.ZodString;
|
|
41
|
+
outcome: z.ZodString;
|
|
42
|
+
}, z.core.$strip>;
|
|
43
|
+
export type PerSkillScanItem = z.infer<typeof perSkillScanItemSchema>;
|
|
44
|
+
/** Dedicated-section block for `review_mode: dedicated` skills. */
|
|
45
|
+
export declare const dedicatedSectionSchema: z.ZodObject<{
|
|
46
|
+
section_name: z.ZodString;
|
|
47
|
+
skill: z.ZodString;
|
|
48
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
49
|
+
skill: z.ZodString;
|
|
50
|
+
file: z.ZodOptional<z.ZodString>;
|
|
51
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
52
|
+
summary: z.ZodString;
|
|
53
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
54
|
+
}, z.core.$strip>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
export type DedicatedSection = z.infer<typeof dedicatedSectionSchema>;
|
|
57
|
+
/**
|
|
58
|
+
* Full review payload — wire shape. The model produces this; the App
|
|
59
|
+
* orchestrator immediately flattens to the internal `Finding[]` shape via
|
|
60
|
+
* `flattenFindings()` for multi-pass + aggregator work, then unflattens
|
|
61
|
+
* back via `unflattenFindings()` before writeback.
|
|
62
|
+
*/
|
|
63
|
+
export declare const reviewSchema: z.ZodObject<{
|
|
64
|
+
status_header: z.ZodEnum<{
|
|
65
|
+
"critical findings": "critical findings";
|
|
66
|
+
clean: "clean";
|
|
67
|
+
bare: "bare";
|
|
68
|
+
}>;
|
|
69
|
+
summary_counts: z.ZodObject<{
|
|
70
|
+
critical: z.ZodNumber;
|
|
71
|
+
minor: z.ZodNumber;
|
|
72
|
+
preexisting: z.ZodNumber;
|
|
73
|
+
resolved_from_prior: z.ZodNumber;
|
|
74
|
+
still_open: z.ZodNumber;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
per_skill_scan: z.ZodArray<z.ZodObject<{
|
|
77
|
+
skill: z.ZodString;
|
|
78
|
+
outcome: z.ZodString;
|
|
79
|
+
}, z.core.$strip>>;
|
|
80
|
+
critical_findings: z.ZodArray<z.ZodObject<{
|
|
81
|
+
skill: z.ZodString;
|
|
82
|
+
file: z.ZodOptional<z.ZodString>;
|
|
83
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
84
|
+
summary: z.ZodString;
|
|
85
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, z.core.$strip>>;
|
|
87
|
+
minor_findings: z.ZodArray<z.ZodObject<{
|
|
88
|
+
skill: z.ZodString;
|
|
89
|
+
file: z.ZodOptional<z.ZodString>;
|
|
90
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
91
|
+
summary: z.ZodString;
|
|
92
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
93
|
+
}, z.core.$strip>>;
|
|
94
|
+
preexisting_findings: z.ZodArray<z.ZodObject<{
|
|
95
|
+
skill: z.ZodString;
|
|
96
|
+
file: z.ZodOptional<z.ZodString>;
|
|
97
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
98
|
+
summary: z.ZodString;
|
|
99
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
dedicated_sections: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
102
|
+
section_name: z.ZodString;
|
|
103
|
+
skill: z.ZodString;
|
|
104
|
+
findings: z.ZodArray<z.ZodObject<{
|
|
105
|
+
skill: z.ZodString;
|
|
106
|
+
file: z.ZodOptional<z.ZodString>;
|
|
107
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
108
|
+
summary: z.ZodString;
|
|
109
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
110
|
+
}, z.core.$strip>>;
|
|
111
|
+
}, z.core.$strip>>>;
|
|
112
|
+
diagnostics: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
113
|
+
skills_referenced: z.ZodArray<z.ZodString>;
|
|
114
|
+
last_reviewed_sha: z.ZodString;
|
|
115
|
+
}, z.core.$strip>;
|
|
116
|
+
export type Review = z.infer<typeof reviewSchema>;
|
|
117
|
+
/**
|
|
118
|
+
* Internal flat-finding type used by App orchestrator, multi-pass
|
|
119
|
+
* aggregator, skill-usage telemetry, etc. Created from a wire-shape
|
|
120
|
+
* `Review` via `flattenFindings()`. Has explicit `severity` field so
|
|
121
|
+
* internal code doesn't need to track which array a finding came from.
|
|
122
|
+
*
|
|
123
|
+
* Exported from the core barrel as `ZodFinding` to disambiguate from
|
|
124
|
+
* the CLI-shape `ReviewFinding` (which never carries severity — its
|
|
125
|
+
* severity comes from the array it lives in).
|
|
126
|
+
*/
|
|
127
|
+
export type Finding = FindingItem & {
|
|
128
|
+
severity: Severity;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Zod schema describing the internal Finding shape (for tests + cross-check
|
|
132
|
+
* Pass 2 independentFindings). The wire equivalent is `findingItemSchema`
|
|
133
|
+
* which does NOT have severity.
|
|
134
|
+
*/
|
|
135
|
+
export declare const findingSchema: z.ZodObject<{
|
|
136
|
+
skill: z.ZodString;
|
|
137
|
+
file: z.ZodOptional<z.ZodString>;
|
|
138
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
summary: z.ZodString;
|
|
140
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
141
|
+
severity: z.ZodEnum<{
|
|
142
|
+
critical: "critical";
|
|
143
|
+
minor: "minor";
|
|
144
|
+
preexisting: "preexisting";
|
|
145
|
+
}>;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
/**
|
|
148
|
+
* Flatten wire-shape `Review.critical_findings / minor_findings /
|
|
149
|
+
* preexisting_findings` into a single `Finding[]` with severity tagged.
|
|
150
|
+
* Preserves ordering: criticals first, then minors, then preexistings.
|
|
151
|
+
*/
|
|
152
|
+
export declare function flattenFindings(review: Review): Finding[];
|
|
153
|
+
/**
|
|
154
|
+
* Inverse of `flattenFindings`: split a flat `Finding[]` back into the
|
|
155
|
+
* three wire-shape arrays. Used at writeback time after multi-pass
|
|
156
|
+
* aggregation has produced the final flat list.
|
|
157
|
+
*/
|
|
158
|
+
export declare function unflattenFindings(findings: Finding[]): {
|
|
159
|
+
critical_findings: FindingItem[];
|
|
160
|
+
minor_findings: FindingItem[];
|
|
161
|
+
preexisting_findings: FindingItem[];
|
|
162
|
+
};
|
|
163
|
+
/**
|
|
164
|
+
* Derive `summary_counts` from a flat `Finding[]` list. Canonical
|
|
165
|
+
* source-of-truth used by the orchestrator after flattening, to
|
|
166
|
+
* overwrite the model's potentially-drifted counts.
|
|
167
|
+
*/
|
|
168
|
+
export declare function deriveSummaryCounts(findings: Finding[]): SummaryCounts;
|
|
169
|
+
/**
|
|
170
|
+
* Derive `skills_referenced` from a flat `Finding[]` list, preserving
|
|
171
|
+
* citation order (first appearance wins) and deduplicating.
|
|
172
|
+
*/
|
|
173
|
+
export declare function deriveSkillsReferenced(findings: Finding[]): string[];
|
|
174
|
+
/**
|
|
175
|
+
* Test helper: build a wire-shape `Review` from a flat `Finding[]` list.
|
|
176
|
+
* Tests historically built reviews with a flat `findings: [...]` field; the
|
|
177
|
+
* wire shape (separate severity arrays + per_skill_scan + last_reviewed_sha
|
|
178
|
+
* required) is more verbose. This helper keeps fixtures short — pass a
|
|
179
|
+
* flat list, get back a valid wire-shape Review with derived counts and
|
|
180
|
+
* skills.
|
|
181
|
+
*
|
|
182
|
+
* Production code should NOT use this; it constructs reviews from AI output
|
|
183
|
+
* directly. This is purely for test ergonomics.
|
|
184
|
+
*/
|
|
185
|
+
export declare function buildReviewFromFindings(opts: {
|
|
186
|
+
findings: Finding[];
|
|
187
|
+
status_header?: StatusHeader;
|
|
188
|
+
last_reviewed_sha?: string;
|
|
189
|
+
per_skill_scan?: PerSkillScanItem[];
|
|
190
|
+
dedicated_sections?: DedicatedSection[];
|
|
191
|
+
diagnostics?: string[];
|
|
192
|
+
}): Review;
|
|
193
|
+
/**
|
|
194
|
+
* Per-finding verdict from a cross-check pass. The pass2 model echoes
|
|
195
|
+
* back Pass 1's findings by 0-indexed `pass1Index` + `agreed`/`disagreed`
|
|
196
|
+
* + rationale. The aggregator stitches these into
|
|
197
|
+
* `MultiPassReview.findings[].attributions`.
|
|
198
|
+
*
|
|
199
|
+
* Cross-check Pass 2 operates on a flat finding list (its own
|
|
200
|
+
* representation), so its independentFindings carry severity — uses the
|
|
201
|
+
* legacy `findingSchema` shape.
|
|
202
|
+
*/
|
|
203
|
+
export declare const crossCheckVerdictSchema: z.ZodObject<{
|
|
204
|
+
pass1Index: z.ZodNumber;
|
|
205
|
+
verdict: z.ZodEnum<{
|
|
206
|
+
agreed: "agreed";
|
|
207
|
+
disagreed: "disagreed";
|
|
208
|
+
}>;
|
|
209
|
+
rationale: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}, z.core.$strip>;
|
|
211
|
+
export type CrossCheckVerdictSchema = z.infer<typeof crossCheckVerdictSchema>;
|
|
212
|
+
/**
|
|
213
|
+
* Full cross-check response. Pass 2 outputs verdicts on Pass-1 findings
|
|
214
|
+
* plus its own independent finds (in the internal `findingSchema` shape
|
|
215
|
+
* with severity, since cross-check works on already-flattened lists).
|
|
216
|
+
*/
|
|
217
|
+
export declare const crossCheckSchema: z.ZodObject<{
|
|
218
|
+
verdicts: z.ZodArray<z.ZodObject<{
|
|
219
|
+
pass1Index: z.ZodNumber;
|
|
220
|
+
verdict: z.ZodEnum<{
|
|
221
|
+
agreed: "agreed";
|
|
222
|
+
disagreed: "disagreed";
|
|
223
|
+
}>;
|
|
224
|
+
rationale: z.ZodOptional<z.ZodString>;
|
|
225
|
+
}, z.core.$strip>>;
|
|
226
|
+
independentFindings: z.ZodArray<z.ZodObject<{
|
|
227
|
+
skill: z.ZodString;
|
|
228
|
+
file: z.ZodOptional<z.ZodString>;
|
|
229
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
230
|
+
summary: z.ZodString;
|
|
231
|
+
reasoning: z.ZodOptional<z.ZodString>;
|
|
232
|
+
severity: z.ZodEnum<{
|
|
233
|
+
critical: "critical";
|
|
234
|
+
minor: "minor";
|
|
235
|
+
preexisting: "preexisting";
|
|
236
|
+
}>;
|
|
237
|
+
}, z.core.$strip>>;
|
|
238
|
+
}, z.core.$strip>;
|
|
239
|
+
export type CrossCheck = z.infer<typeof crossCheckSchema>;
|
|
240
|
+
//# sourceMappingURL=review-schema-zod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-schema-zod.d.ts","sourceRoot":"","sources":["../../src/core/review-schema-zod.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,cAAc,+CAAgD,CAAC;AAC5E,eAAO,MAAM,cAAc;;;;EAAyB,CAAC;AACrD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAGtD,eAAO,MAAM,kBAAkB,iDAIrB,CAAC;AACX,eAAO,MAAM,kBAAkB;;;;EAA6B,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,mBAAmB;;;;;;iBAM9B,CAAC;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;;;iBAM5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,6EAA6E;AAC7E,eAAO,MAAM,sBAAsB;;;iBAGjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE,mEAAmE;AACnE,eAAO,MAAM,sBAAsB;;;;;;;;;;iBAIjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAEtE;;;;;GAKG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AE9E;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;iBAG3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// Zod-typed review schema for the AI-Gateway-shape consumer (clud-bug-app).
|
|
2
|
+
//
|
|
3
|
+
// The CLI runtime in `./review-schema.ts` ships a plain JSON-Schema object
|
|
4
|
+
// because that's what the Agent SDK validator expects on the
|
|
5
|
+
// `--json-schema '<JSON>'` argument. The App's runtime instead funnels the
|
|
6
|
+
// model output through the Vercel AI SDK, which derives a JSON Schema from
|
|
7
|
+
// a Zod schema. Both consumers need to agree on the WIRE shape — separate
|
|
8
|
+
// `critical_findings[] / minor_findings[] / preexisting_findings[]` arrays
|
|
9
|
+
// per SPEC §1.8.1 — but each builds its validator from a different source.
|
|
10
|
+
//
|
|
11
|
+
// This module ports the App's Zod schemas + flat-shape helpers into core
|
|
12
|
+
// so a future drift between the App's Zod and the CLI's JSON-Schema lives
|
|
13
|
+
// in one repo. The equivalence test (test/review-schema-zod.test.js)
|
|
14
|
+
// asserts the two schemas describe the same wire shape (required fields,
|
|
15
|
+
// finding-item shape) for every release.
|
|
16
|
+
//
|
|
17
|
+
// Ported from clud-bug-app/lib/review-schema.ts (commit shipped 2026-06-08).
|
|
18
|
+
// The pure helpers (`flattenFindings`, `unflattenFindings`,
|
|
19
|
+
// `deriveSummaryCounts`, `deriveSkillsReferenced`, `buildReviewFromFindings`)
|
|
20
|
+
// are byte-equivalent to the App's helpers — see test for the equivalence
|
|
21
|
+
// fixtures.
|
|
22
|
+
import { z } from 'zod';
|
|
23
|
+
// Severity buckets per SPEC §1.8.1. Only used by the internal `Finding`
|
|
24
|
+
// type — the wire `findingItemSchema` does NOT carry severity.
|
|
25
|
+
export const severityValues = ['critical', 'minor', 'preexisting'];
|
|
26
|
+
export const severitySchema = z.enum(severityValues);
|
|
27
|
+
// Status header at the top of the review file.
|
|
28
|
+
export const statusHeaderValues = [
|
|
29
|
+
'critical findings',
|
|
30
|
+
'clean',
|
|
31
|
+
'bare',
|
|
32
|
+
];
|
|
33
|
+
export const statusHeaderSchema = z.enum(statusHeaderValues);
|
|
34
|
+
export const summaryCountsSchema = z.object({
|
|
35
|
+
critical: z.number().int().min(0),
|
|
36
|
+
minor: z.number().int().min(0),
|
|
37
|
+
preexisting: z.number().int().min(0),
|
|
38
|
+
resolved_from_prior: z.number().int().min(0),
|
|
39
|
+
still_open: z.number().int().min(0),
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Wire-shape finding item — NO severity field (mirrors the CLI's
|
|
43
|
+
* `FINDING_ITEM` JSON Schema in `./review-schema.ts`). Severity is implicit
|
|
44
|
+
* in which array the item lives in (`critical_findings`/`minor_findings`/
|
|
45
|
+
* `preexisting_findings`).
|
|
46
|
+
*/
|
|
47
|
+
export const findingItemSchema = z.object({
|
|
48
|
+
skill: z.string().min(1),
|
|
49
|
+
file: z.string().optional(),
|
|
50
|
+
line: z.number().int().min(1).optional(),
|
|
51
|
+
summary: z.string().min(1),
|
|
52
|
+
reasoning: z.string().optional(),
|
|
53
|
+
});
|
|
54
|
+
/** Per-skill scan report — one entry per loaded skill (even silent ones). */
|
|
55
|
+
export const perSkillScanItemSchema = z.object({
|
|
56
|
+
skill: z.string(),
|
|
57
|
+
outcome: z.string(),
|
|
58
|
+
});
|
|
59
|
+
/** Dedicated-section block for `review_mode: dedicated` skills. */
|
|
60
|
+
export const dedicatedSectionSchema = z.object({
|
|
61
|
+
section_name: z.string(),
|
|
62
|
+
skill: z.string(),
|
|
63
|
+
findings: z.array(findingItemSchema),
|
|
64
|
+
});
|
|
65
|
+
/**
|
|
66
|
+
* Full review payload — wire shape. The model produces this; the App
|
|
67
|
+
* orchestrator immediately flattens to the internal `Finding[]` shape via
|
|
68
|
+
* `flattenFindings()` for multi-pass + aggregator work, then unflattens
|
|
69
|
+
* back via `unflattenFindings()` before writeback.
|
|
70
|
+
*/
|
|
71
|
+
export const reviewSchema = z.object({
|
|
72
|
+
status_header: statusHeaderSchema,
|
|
73
|
+
summary_counts: summaryCountsSchema,
|
|
74
|
+
per_skill_scan: z.array(perSkillScanItemSchema),
|
|
75
|
+
critical_findings: z.array(findingItemSchema),
|
|
76
|
+
minor_findings: z.array(findingItemSchema),
|
|
77
|
+
preexisting_findings: z.array(findingItemSchema),
|
|
78
|
+
dedicated_sections: z.array(dedicatedSectionSchema).optional(),
|
|
79
|
+
diagnostics: z.array(z.string()).optional(),
|
|
80
|
+
skills_referenced: z.array(z.string()),
|
|
81
|
+
last_reviewed_sha: z.string(),
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Zod schema describing the internal Finding shape (for tests + cross-check
|
|
85
|
+
* Pass 2 independentFindings). The wire equivalent is `findingItemSchema`
|
|
86
|
+
* which does NOT have severity.
|
|
87
|
+
*/
|
|
88
|
+
export const findingSchema = findingItemSchema.extend({
|
|
89
|
+
severity: severitySchema,
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* Flatten wire-shape `Review.critical_findings / minor_findings /
|
|
93
|
+
* preexisting_findings` into a single `Finding[]` with severity tagged.
|
|
94
|
+
* Preserves ordering: criticals first, then minors, then preexistings.
|
|
95
|
+
*/
|
|
96
|
+
export function flattenFindings(review) {
|
|
97
|
+
const out = [];
|
|
98
|
+
for (const f of review.critical_findings)
|
|
99
|
+
out.push({ ...f, severity: 'critical' });
|
|
100
|
+
for (const f of review.minor_findings)
|
|
101
|
+
out.push({ ...f, severity: 'minor' });
|
|
102
|
+
for (const f of review.preexisting_findings)
|
|
103
|
+
out.push({ ...f, severity: 'preexisting' });
|
|
104
|
+
return out;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Inverse of `flattenFindings`: split a flat `Finding[]` back into the
|
|
108
|
+
* three wire-shape arrays. Used at writeback time after multi-pass
|
|
109
|
+
* aggregation has produced the final flat list.
|
|
110
|
+
*/
|
|
111
|
+
export function unflattenFindings(findings) {
|
|
112
|
+
const stripSeverity = (f) => {
|
|
113
|
+
const { severity: _s, ...rest } = f;
|
|
114
|
+
return rest;
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
critical_findings: findings.filter((f) => f.severity === 'critical').map(stripSeverity),
|
|
118
|
+
minor_findings: findings.filter((f) => f.severity === 'minor').map(stripSeverity),
|
|
119
|
+
preexisting_findings: findings.filter((f) => f.severity === 'preexisting').map(stripSeverity),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Derive `summary_counts` from a flat `Finding[]` list. Canonical
|
|
124
|
+
* source-of-truth used by the orchestrator after flattening, to
|
|
125
|
+
* overwrite the model's potentially-drifted counts.
|
|
126
|
+
*/
|
|
127
|
+
export function deriveSummaryCounts(findings) {
|
|
128
|
+
return {
|
|
129
|
+
critical: findings.filter((f) => f.severity === 'critical').length,
|
|
130
|
+
minor: findings.filter((f) => f.severity === 'minor').length,
|
|
131
|
+
preexisting: findings.filter((f) => f.severity === 'preexisting').length,
|
|
132
|
+
resolved_from_prior: 0,
|
|
133
|
+
still_open: 0,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Derive `skills_referenced` from a flat `Finding[]` list, preserving
|
|
138
|
+
* citation order (first appearance wins) and deduplicating.
|
|
139
|
+
*/
|
|
140
|
+
export function deriveSkillsReferenced(findings) {
|
|
141
|
+
const seen = new Set();
|
|
142
|
+
const out = [];
|
|
143
|
+
for (const f of findings) {
|
|
144
|
+
if (seen.has(f.skill))
|
|
145
|
+
continue;
|
|
146
|
+
seen.add(f.skill);
|
|
147
|
+
out.push(f.skill);
|
|
148
|
+
}
|
|
149
|
+
return out;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Test helper: build a wire-shape `Review` from a flat `Finding[]` list.
|
|
153
|
+
* Tests historically built reviews with a flat `findings: [...]` field; the
|
|
154
|
+
* wire shape (separate severity arrays + per_skill_scan + last_reviewed_sha
|
|
155
|
+
* required) is more verbose. This helper keeps fixtures short — pass a
|
|
156
|
+
* flat list, get back a valid wire-shape Review with derived counts and
|
|
157
|
+
* skills.
|
|
158
|
+
*
|
|
159
|
+
* Production code should NOT use this; it constructs reviews from AI output
|
|
160
|
+
* directly. This is purely for test ergonomics.
|
|
161
|
+
*/
|
|
162
|
+
export function buildReviewFromFindings(opts) {
|
|
163
|
+
const split = unflattenFindings(opts.findings);
|
|
164
|
+
// Default status_header is derived from severity, NOT just emptiness.
|
|
165
|
+
// The App's original buildReviewFromFindings defaulted to
|
|
166
|
+
// 'critical findings' for ANY non-empty list, including minor-only and
|
|
167
|
+
// preexisting-only inputs. That was a bug (caught by clud-bug-review
|
|
168
|
+
// on PR #158): a review with only minor findings should be 'clean', not
|
|
169
|
+
// 'critical findings'. Fixed here on port to core.
|
|
170
|
+
//
|
|
171
|
+
// Callers that need the old behavior can pass `status_header` explicitly.
|
|
172
|
+
// Callers that want SPEC §1.8.1 semantics (the default) get the correct
|
|
173
|
+
// bucket: criticals present → 'critical findings'; else → 'clean'.
|
|
174
|
+
const hasCritical = opts.findings.some((f) => f.severity === 'critical');
|
|
175
|
+
const defaultStatus = hasCritical ? 'critical findings' : 'clean';
|
|
176
|
+
return {
|
|
177
|
+
status_header: opts.status_header ?? defaultStatus,
|
|
178
|
+
summary_counts: deriveSummaryCounts(opts.findings),
|
|
179
|
+
skills_referenced: deriveSkillsReferenced(opts.findings),
|
|
180
|
+
per_skill_scan: opts.per_skill_scan ?? [],
|
|
181
|
+
critical_findings: split.critical_findings,
|
|
182
|
+
minor_findings: split.minor_findings,
|
|
183
|
+
preexisting_findings: split.preexisting_findings,
|
|
184
|
+
...(opts.dedicated_sections !== undefined
|
|
185
|
+
? { dedicated_sections: opts.dedicated_sections }
|
|
186
|
+
: {}),
|
|
187
|
+
...(opts.diagnostics !== undefined ? { diagnostics: opts.diagnostics } : {}),
|
|
188
|
+
last_reviewed_sha: opts.last_reviewed_sha ?? '',
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
// ---------------------------------------------------------------------------
|
|
192
|
+
// D.2.5 — cross-check pass schema
|
|
193
|
+
// ---------------------------------------------------------------------------
|
|
194
|
+
/**
|
|
195
|
+
* Per-finding verdict from a cross-check pass. The pass2 model echoes
|
|
196
|
+
* back Pass 1's findings by 0-indexed `pass1Index` + `agreed`/`disagreed`
|
|
197
|
+
* + rationale. The aggregator stitches these into
|
|
198
|
+
* `MultiPassReview.findings[].attributions`.
|
|
199
|
+
*
|
|
200
|
+
* Cross-check Pass 2 operates on a flat finding list (its own
|
|
201
|
+
* representation), so its independentFindings carry severity — uses the
|
|
202
|
+
* legacy `findingSchema` shape.
|
|
203
|
+
*/
|
|
204
|
+
export const crossCheckVerdictSchema = z.object({
|
|
205
|
+
pass1Index: z.number().int().min(0),
|
|
206
|
+
verdict: z.enum(['agreed', 'disagreed']),
|
|
207
|
+
rationale: z.string().optional(),
|
|
208
|
+
});
|
|
209
|
+
/**
|
|
210
|
+
* Full cross-check response. Pass 2 outputs verdicts on Pass-1 findings
|
|
211
|
+
* plus its own independent finds (in the internal `findingSchema` shape
|
|
212
|
+
* with severity, since cross-check works on already-flattened lists).
|
|
213
|
+
*/
|
|
214
|
+
export const crossCheckSchema = z.object({
|
|
215
|
+
verdicts: z.array(crossCheckVerdictSchema),
|
|
216
|
+
independentFindings: z.array(findingSchema),
|
|
217
|
+
});
|
|
218
|
+
//# sourceMappingURL=review-schema-zod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-schema-zod.js","sourceRoot":"","sources":["../../src/core/review-schema-zod.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,2EAA2E;AAC3E,6DAA6D;AAC7D,2EAA2E;AAC3E,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,2EAA2E;AAC3E,EAAE;AACF,yEAAyE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,CAAC;AAED,8EAA8E;AAC9E,kCAAkC;AAClC,8EAA8E;AAE9E;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACnC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC;AAGH;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,uBAAuB,CAAC;IAC1C,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC;CAC5C,CAAC,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { type Finding, type Review } from './review-schema-zod.js';
|
|
2
|
+
/** Protocol version this implementation emits. */
|
|
3
|
+
export declare const PROTOCOL_VERSION = "0.1.0";
|
|
4
|
+
/** "Written by" tag for the App writeback (SPEC §6.1). */
|
|
5
|
+
export declare const WRITTEN_BY = "clud-bug[bot]";
|
|
6
|
+
export declare const SEVERITY_EMOJI: {
|
|
7
|
+
readonly critical: "🔴";
|
|
8
|
+
readonly minor: "🟡";
|
|
9
|
+
readonly preexisting: "🟣";
|
|
10
|
+
};
|
|
11
|
+
export interface RenderReviewFileInput {
|
|
12
|
+
review: Review;
|
|
13
|
+
prNumber: number;
|
|
14
|
+
/** 40-char head SHA. Pinned to `<!-- review-sha: ... -->`. */
|
|
15
|
+
headSha: string;
|
|
16
|
+
/** GitHub PR URL — appended verbatim to the trailing rule. */
|
|
17
|
+
prUrl: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Renders the review object to the SPEC §1.8.1 markdown template.
|
|
21
|
+
*
|
|
22
|
+
* Pure: no I/O, no time-of-day, no provider info — fixture-stable.
|
|
23
|
+
*
|
|
24
|
+
* NB: This produces the doc-file shape (`# clud-bug review — PR #N` H1).
|
|
25
|
+
* The CLI's `renderReview` produces the PR-comment shape (`## 🐛 Clud Bug
|
|
26
|
+
* review` H2). Both are valid review outputs; SPEC §6.2 says they share
|
|
27
|
+
* the underlying finding data but differ in container.
|
|
28
|
+
*/
|
|
29
|
+
export declare function renderReviewFile(input: RenderReviewFileInput): string;
|
|
30
|
+
/**
|
|
31
|
+
* Provenance label for a single finding's attribution from one pass.
|
|
32
|
+
* Mirrors the App's `PassSource` discriminator.
|
|
33
|
+
*
|
|
34
|
+
* `mode === 'cross-check'`:
|
|
35
|
+
* - 'first' → finding raised by Pass 1
|
|
36
|
+
* - 'agreed' → later pass agreed
|
|
37
|
+
* - 'disagreed' → later pass disagreed
|
|
38
|
+
* - 'independent' → later pass surfaced this finding independently
|
|
39
|
+
*
|
|
40
|
+
* `mode === 'consensus'`:
|
|
41
|
+
* - 'first' → finding tuple unique to Pass 1
|
|
42
|
+
* - 'independent' → finding tuple unique to Pass N (N > 1)
|
|
43
|
+
* - 'agreed' → finding tuple appeared in 2+ passes (consensus)
|
|
44
|
+
*/
|
|
45
|
+
export type PassSource = 'first' | 'agreed' | 'disagreed' | 'independent';
|
|
46
|
+
export interface PassAttribution {
|
|
47
|
+
/** 1-indexed pass number — matches the spec's "[Pass N]" label. */
|
|
48
|
+
passNumber: number;
|
|
49
|
+
/** Role display name, e.g. "Beetle". */
|
|
50
|
+
roleName: string;
|
|
51
|
+
/** Model slug for this pass — used by the renderer for the "· Sonnet 4.6" tail. */
|
|
52
|
+
model: string;
|
|
53
|
+
/** Provenance — see PassSource doc. */
|
|
54
|
+
source: PassSource;
|
|
55
|
+
/** Optional one-line note from the pass, e.g. cross-check rationale. */
|
|
56
|
+
note?: string;
|
|
57
|
+
}
|
|
58
|
+
export interface UnifiedFinding extends Finding {
|
|
59
|
+
/** One PassAttribution per pass involved with this finding. Order: by passNumber. */
|
|
60
|
+
attributions: PassAttribution[];
|
|
61
|
+
}
|
|
62
|
+
/** Effective resolution verdict the multi-pass orchestrator emits. */
|
|
63
|
+
export type MultiPassVerdict = 'request_changes' | 'review_only' | 'clean';
|
|
64
|
+
/** Effective multi-pass mode. */
|
|
65
|
+
export type ReviewPassMode = 'cross-check' | 'consensus' | 'independent';
|
|
66
|
+
export interface MultiPassReview {
|
|
67
|
+
/** Status header — derived from aggregated findings + mode resolution rules. */
|
|
68
|
+
status_header: Review['status_header'];
|
|
69
|
+
/** Summary counts, derived from the unified findings list. */
|
|
70
|
+
summary_counts: Review['summary_counts'];
|
|
71
|
+
/** Skills cited at least once across any pass. */
|
|
72
|
+
skills_referenced: string[];
|
|
73
|
+
/** Unified findings, with per-pass attribution. */
|
|
74
|
+
findings: UnifiedFinding[];
|
|
75
|
+
/** Effective mode (for the renderer's "(N passes · mode)" header line). */
|
|
76
|
+
mode: ReviewPassMode;
|
|
77
|
+
/** Number of passes that actually ran. */
|
|
78
|
+
passCount: number;
|
|
79
|
+
/** Role labels per pass, parallel to passCount. Used by the renderer. */
|
|
80
|
+
roles: Array<{
|
|
81
|
+
passNumber: number;
|
|
82
|
+
roleName: string;
|
|
83
|
+
model: string;
|
|
84
|
+
}>;
|
|
85
|
+
/** Resolution verdict — see App's multi-pass-aggregator for derivation. */
|
|
86
|
+
verdict: MultiPassVerdict;
|
|
87
|
+
}
|
|
88
|
+
export interface RenderMultiPassMarkdownInput {
|
|
89
|
+
review: MultiPassReview;
|
|
90
|
+
prNumber: number;
|
|
91
|
+
/** 40-char head SHA. Pinned to `<!-- review-sha: ... -->`. */
|
|
92
|
+
headSha: string;
|
|
93
|
+
/** GitHub PR URL — appended verbatim to the trailing rule. */
|
|
94
|
+
prUrl: string;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Renders a multi-pass review with per-pass attribution lines.
|
|
98
|
+
*
|
|
99
|
+
* Output layout (SPEC §1.8.5):
|
|
100
|
+
*
|
|
101
|
+
* # clud-bug review — PR #N (M passes · mode)
|
|
102
|
+
* <!-- protocol-version: ... -->
|
|
103
|
+
* <!-- written-by: clud-bug[bot] -->
|
|
104
|
+
* <!-- review-sha: ... -->
|
|
105
|
+
* <!-- passes: M -->
|
|
106
|
+
* <!-- mode: cross-check|consensus|independent -->
|
|
107
|
+
*
|
|
108
|
+
* **Summary:** ... · **Verdict:** request_changes / review_only / clean
|
|
109
|
+
*
|
|
110
|
+
* **Reviewers:**
|
|
111
|
+
* - Pass 1 — Beetle · anthropic/claude-sonnet-4.6
|
|
112
|
+
* - Pass 2 — Wasp · anthropic/claude-opus-4.7
|
|
113
|
+
*
|
|
114
|
+
* **Skills cited:** ...
|
|
115
|
+
*
|
|
116
|
+
* **Findings:**
|
|
117
|
+
*
|
|
118
|
+
* ### (red) Critical
|
|
119
|
+
* - [Pass 1 — Beetle · Sonnet 4.6] auth.ts:42 — race-conditions: Race condition
|
|
120
|
+
* Reasoning: ...
|
|
121
|
+
* [Pass 2 — Wasp · Opus 4.7]: (check) AGREED — same finding identified independently.
|
|
122
|
+
*
|
|
123
|
+
* ...
|
|
124
|
+
*
|
|
125
|
+
* ---
|
|
126
|
+
* [Link to PR](...)
|
|
127
|
+
*
|
|
128
|
+
* Pure: no I/O, no time-of-day, fixture-stable.
|
|
129
|
+
*/
|
|
130
|
+
export declare function renderMultiPassMarkdown(input: RenderMultiPassMarkdownInput): string;
|
|
131
|
+
/** SPEC §6.1 / §1.8 path. The App's Octokit writeback uses this. */
|
|
132
|
+
export declare function reviewFilePath(prNumber: number): string;
|
|
133
|
+
/**
|
|
134
|
+
* SPEC §6.1 commit message: exactly `[skip-logmind] clud-bug review: PR #<n>`.
|
|
135
|
+
* The `[skip-logmind]` prefix tells `check-decisions.yml` to ignore this
|
|
136
|
+
* commit (SPEC §6.4). The App's Octokit writeback uses this.
|
|
137
|
+
*/
|
|
138
|
+
export declare function reviewCommitMessage(prNumber: number): string;
|
|
139
|
+
//# sourceMappingURL=review-writeback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-writeback.d.ts","sourceRoot":"","sources":["../../src/core/review-writeback.ts"],"names":[],"mappings":"AAwBA,OAAO,EAIL,KAAK,OAAO,EACZ,KAAK,MAAM,EACZ,MAAM,wBAAwB,CAAC;AAEhC,kDAAkD;AAClD,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,0DAA0D;AAC1D,eAAO,MAAM,UAAU,kBAAkB,CAAC;AAM1C,eAAO,MAAM,cAAc;;;;CAIjB,CAAC;AAEX,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,CAsErE;AAkCD;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,mEAAmE;IACnE,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,KAAK,EAAE,MAAM,CAAC;IACd,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAC;IACnB,wEAAwE;IACxE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAe,SAAQ,OAAO;IAC7C,qFAAqF;IACrF,YAAY,EAAE,eAAe,EAAE,CAAC;CACjC;AAED,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,GAAG,aAAa,GAAG,OAAO,CAAC;AAE3E,iCAAiC;AACjC,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