@nt-ai-lab/deterministic-agent-workflow-engine 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -6,8 +6,10 @@ export type { EventEnvelope, StoredEvent, } from './platform/domain/stored-event
6
6
  export { flattenStoredEvent, stripEnvelopeKeys, toPayload, } from './platform/domain/stored-event';
7
7
  export { reflectionCategorySchema, reflectionConfidenceSchema, reflectionEvidenceSchema, reflectionFindingSchema, reflectionPayloadSchema, recordReflectionInputSchema, storedReflectionSchema, } from './platform/domain/reflection-types';
8
8
  export type { ReflectionCategory, ReflectionEvidence, ReflectionFinding, ReflectionPayload, RecordReflectionInput, StoredReflection, } from './platform/domain/reflection-types';
9
+ export { reviewTypeSchema, reviewVerdictSchema, reviewFindingSeveritySchema, reviewFindingStatusSchema, reviewFindingSchema, reviewPayloadSchema, recordReviewInputSchema, storedReviewSchema, listedReviewSchema, reviewFiltersSchema, } from './platform/domain/review-types';
10
+ export type { ReviewType, ReviewVerdict, ReviewFindingSeverity, ReviewFindingStatus, ReviewFinding, ReviewPayload, RecordReviewInput, StoredReview, ListedReview, ReviewFilters, } from './platform/domain/review-types';
9
11
  export { engineEventSchema } from './platform/domain/engine-events';
10
- export type { EngineEvent, SessionStartedEvent, TransitionedEvent, AgentRegisteredEvent, AgentShutDownEvent, JournalEntryEvent, WriteCheckedEvent, BashCheckedEvent, PluginReadCheckedEvent, IdleCheckedEvent, IdentityVerifiedEvent, ContextRequestedEvent, } from './platform/domain/engine-events';
12
+ export type { EngineEvent, SessionStartedEvent, TransitionedEvent, AgentRegisteredEvent, AgentShutDownEvent, JournalEntryEvent, WriteCheckedEvent, BashCheckedEvent, PluginReadCheckedEvent, IdleCheckedEvent, IdentityVerifiedEvent, ContextRequestedEvent, ReviewRecordedEvent, } from './platform/domain/engine-events';
11
13
  export { repositoryMetadataEventSchema } from './platform/domain/repository-tracking-events';
12
14
  export type { DomainMetadataEvent, IssueRecordedEvent, BranchRecordedEvent, PrRecordedEvent, } from './platform/domain/repository-tracking-events';
13
15
  export { checkBashCommand } from './platform/domain/bash-enforcement';
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export { WorkflowStateError } from './platform/domain/workflow-state.js';
2
2
  export { baseEventSchema } from './platform/domain/base-event.js';
3
3
  export { flattenStoredEvent, stripEnvelopeKeys, toPayload, } from './platform/domain/stored-event.js';
4
4
  export { reflectionCategorySchema, reflectionConfidenceSchema, reflectionEvidenceSchema, reflectionFindingSchema, reflectionPayloadSchema, recordReflectionInputSchema, storedReflectionSchema, } from './platform/domain/reflection-types.js';
5
+ export { reviewTypeSchema, reviewVerdictSchema, reviewFindingSeveritySchema, reviewFindingStatusSchema, reviewFindingSchema, reviewPayloadSchema, recordReviewInputSchema, storedReviewSchema, listedReviewSchema, reviewFiltersSchema, } from './platform/domain/review-types.js';
5
6
  export { engineEventSchema } from './platform/domain/engine-events.js';
6
7
  export { repositoryMetadataEventSchema } from './platform/domain/repository-tracking-events.js';
7
8
  export { checkBashCommand } from './platform/domain/bash-enforcement.js';
@@ -9,15 +9,15 @@ declare const sessionStartedSchema: z.ZodObject<{
9
9
  }, "strip", z.ZodTypeAny, {
10
10
  type: "session-started";
11
11
  at: string;
12
- transcriptPath?: string | undefined;
13
12
  repository?: string | undefined;
13
+ transcriptPath?: string | undefined;
14
14
  currentState?: string | undefined;
15
15
  states?: string[] | undefined;
16
16
  }, {
17
17
  type: "session-started";
18
18
  at: string;
19
- transcriptPath?: string | undefined;
20
19
  repository?: string | undefined;
20
+ transcriptPath?: string | undefined;
21
21
  currentState?: string | undefined;
22
22
  states?: string[] | undefined;
23
23
  }>;
@@ -208,6 +208,25 @@ declare const contextRequestedSchema: z.ZodObject<{
208
208
  at: string;
209
209
  agentName: string;
210
210
  }>;
211
+ declare const reviewRecordedSchema: z.ZodObject<{
212
+ type: z.ZodLiteral<"review-recorded">;
213
+ at: z.ZodString;
214
+ reviewId: z.ZodNumber;
215
+ reviewType: z.ZodString;
216
+ verdict: z.ZodEnum<["PASS", "FAIL"]>;
217
+ }, "strip", z.ZodTypeAny, {
218
+ type: "review-recorded";
219
+ at: string;
220
+ verdict: "PASS" | "FAIL";
221
+ reviewType: string;
222
+ reviewId: number;
223
+ }, {
224
+ type: "review-recorded";
225
+ at: string;
226
+ verdict: "PASS" | "FAIL";
227
+ reviewType: string;
228
+ reviewId: number;
229
+ }>;
211
230
  export declare const engineEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
212
231
  type: z.ZodLiteral<"session-started">;
213
232
  at: z.ZodString;
@@ -218,15 +237,15 @@ export declare const engineEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodOb
218
237
  }, "strip", z.ZodTypeAny, {
219
238
  type: "session-started";
220
239
  at: string;
221
- transcriptPath?: string | undefined;
222
240
  repository?: string | undefined;
241
+ transcriptPath?: string | undefined;
223
242
  currentState?: string | undefined;
224
243
  states?: string[] | undefined;
225
244
  }, {
226
245
  type: "session-started";
227
246
  at: string;
228
- transcriptPath?: string | undefined;
229
247
  repository?: string | undefined;
248
+ transcriptPath?: string | undefined;
230
249
  currentState?: string | undefined;
231
250
  states?: string[] | undefined;
232
251
  }>, z.ZodObject<{
@@ -406,6 +425,24 @@ export declare const engineEventSchema: z.ZodDiscriminatedUnion<"type", [z.ZodOb
406
425
  type: "context-requested";
407
426
  at: string;
408
427
  agentName: string;
428
+ }>, z.ZodObject<{
429
+ type: z.ZodLiteral<"review-recorded">;
430
+ at: z.ZodString;
431
+ reviewId: z.ZodNumber;
432
+ reviewType: z.ZodString;
433
+ verdict: z.ZodEnum<["PASS", "FAIL"]>;
434
+ }, "strip", z.ZodTypeAny, {
435
+ type: "review-recorded";
436
+ at: string;
437
+ verdict: "PASS" | "FAIL";
438
+ reviewType: string;
439
+ reviewId: number;
440
+ }, {
441
+ type: "review-recorded";
442
+ at: string;
443
+ verdict: "PASS" | "FAIL";
444
+ reviewType: string;
445
+ reviewId: number;
409
446
  }>]>;
410
447
  /** @riviere-role value-object */
411
448
  export type EngineEvent = z.infer<typeof engineEventSchema>;
@@ -431,4 +468,6 @@ export type IdleCheckedEvent = z.infer<typeof idleCheckedSchema>;
431
468
  export type IdentityVerifiedEvent = z.infer<typeof identityVerifiedSchema>;
432
469
  /** @riviere-role value-object */
433
470
  export type ContextRequestedEvent = z.infer<typeof contextRequestedSchema>;
471
+ /** @riviere-role value-object */
472
+ export type ReviewRecordedEvent = z.infer<typeof reviewRecordedSchema>;
434
473
  export {};
@@ -76,6 +76,13 @@ const contextRequestedSchema = z.object({
76
76
  at: z.string(),
77
77
  agentName: z.string(),
78
78
  });
79
+ const reviewRecordedSchema = z.object({
80
+ type: z.literal('review-recorded'),
81
+ at: z.string(),
82
+ reviewId: z.number().int().positive(),
83
+ reviewType: z.string(),
84
+ verdict: z.enum(['PASS', 'FAIL']),
85
+ });
79
86
  export const engineEventSchema = z.discriminatedUnion('type', [
80
87
  sessionStartedSchema,
81
88
  transitionedSchema,
@@ -88,4 +95,5 @@ export const engineEventSchema = z.discriminatedUnion('type', [
88
95
  idleCheckedSchema,
89
96
  identityVerifiedSchema,
90
97
  contextRequestedSchema,
98
+ reviewRecordedSchema,
91
99
  ]);
@@ -0,0 +1,496 @@
1
+ import { z } from 'zod';
2
+ export declare const reviewTypeSchema: z.ZodString;
3
+ export declare const reviewVerdictSchema: z.ZodEnum<["PASS", "FAIL"]>;
4
+ export declare const reviewFindingSeveritySchema: z.ZodEnum<["minor", "major", "critical"]>;
5
+ export declare const reviewFindingStatusSchema: z.ZodEnum<["blocking", "non-blocking", "accepted-risk"]>;
6
+ export declare const reviewFindingSchema: z.ZodEffects<z.ZodObject<{
7
+ title: z.ZodOptional<z.ZodString>;
8
+ severity: z.ZodOptional<z.ZodEnum<["minor", "major", "critical"]>>;
9
+ status: z.ZodOptional<z.ZodEnum<["blocking", "non-blocking", "accepted-risk"]>>;
10
+ rule: z.ZodOptional<z.ZodString>;
11
+ file: z.ZodOptional<z.ZodString>;
12
+ startLine: z.ZodOptional<z.ZodNumber>;
13
+ endLine: z.ZodOptional<z.ZodNumber>;
14
+ details: z.ZodOptional<z.ZodString>;
15
+ recommendation: z.ZodOptional<z.ZodString>;
16
+ }, "strict", z.ZodTypeAny, {
17
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
18
+ title?: string | undefined;
19
+ severity?: "minor" | "major" | "critical" | undefined;
20
+ rule?: string | undefined;
21
+ file?: string | undefined;
22
+ startLine?: number | undefined;
23
+ endLine?: number | undefined;
24
+ details?: string | undefined;
25
+ recommendation?: string | undefined;
26
+ }, {
27
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
28
+ title?: string | undefined;
29
+ severity?: "minor" | "major" | "critical" | undefined;
30
+ rule?: string | undefined;
31
+ file?: string | undefined;
32
+ startLine?: number | undefined;
33
+ endLine?: number | undefined;
34
+ details?: string | undefined;
35
+ recommendation?: string | undefined;
36
+ }>, {
37
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
38
+ title?: string | undefined;
39
+ severity?: "minor" | "major" | "critical" | undefined;
40
+ rule?: string | undefined;
41
+ file?: string | undefined;
42
+ startLine?: number | undefined;
43
+ endLine?: number | undefined;
44
+ details?: string | undefined;
45
+ recommendation?: string | undefined;
46
+ }, {
47
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
48
+ title?: string | undefined;
49
+ severity?: "minor" | "major" | "critical" | undefined;
50
+ rule?: string | undefined;
51
+ file?: string | undefined;
52
+ startLine?: number | undefined;
53
+ endLine?: number | undefined;
54
+ details?: string | undefined;
55
+ recommendation?: string | undefined;
56
+ }>;
57
+ export declare const reviewPayloadSchema: z.ZodObject<{
58
+ verdict: z.ZodEnum<["PASS", "FAIL"]>;
59
+ summary: z.ZodOptional<z.ZodString>;
60
+ branch: z.ZodOptional<z.ZodString>;
61
+ pullRequestNumber: z.ZodOptional<z.ZodNumber>;
62
+ findings: z.ZodArray<z.ZodEffects<z.ZodObject<{
63
+ title: z.ZodOptional<z.ZodString>;
64
+ severity: z.ZodOptional<z.ZodEnum<["minor", "major", "critical"]>>;
65
+ status: z.ZodOptional<z.ZodEnum<["blocking", "non-blocking", "accepted-risk"]>>;
66
+ rule: z.ZodOptional<z.ZodString>;
67
+ file: z.ZodOptional<z.ZodString>;
68
+ startLine: z.ZodOptional<z.ZodNumber>;
69
+ endLine: z.ZodOptional<z.ZodNumber>;
70
+ details: z.ZodOptional<z.ZodString>;
71
+ recommendation: z.ZodOptional<z.ZodString>;
72
+ }, "strict", z.ZodTypeAny, {
73
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
74
+ title?: string | undefined;
75
+ severity?: "minor" | "major" | "critical" | undefined;
76
+ rule?: string | undefined;
77
+ file?: string | undefined;
78
+ startLine?: number | undefined;
79
+ endLine?: number | undefined;
80
+ details?: string | undefined;
81
+ recommendation?: string | undefined;
82
+ }, {
83
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
84
+ title?: string | undefined;
85
+ severity?: "minor" | "major" | "critical" | undefined;
86
+ rule?: string | undefined;
87
+ file?: string | undefined;
88
+ startLine?: number | undefined;
89
+ endLine?: number | undefined;
90
+ details?: string | undefined;
91
+ recommendation?: string | undefined;
92
+ }>, {
93
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
94
+ title?: string | undefined;
95
+ severity?: "minor" | "major" | "critical" | undefined;
96
+ rule?: string | undefined;
97
+ file?: string | undefined;
98
+ startLine?: number | undefined;
99
+ endLine?: number | undefined;
100
+ details?: string | undefined;
101
+ recommendation?: string | undefined;
102
+ }, {
103
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
104
+ title?: string | undefined;
105
+ severity?: "minor" | "major" | "critical" | undefined;
106
+ rule?: string | undefined;
107
+ file?: string | undefined;
108
+ startLine?: number | undefined;
109
+ endLine?: number | undefined;
110
+ details?: string | undefined;
111
+ recommendation?: string | undefined;
112
+ }>, "many">;
113
+ }, "strict", z.ZodTypeAny, {
114
+ findings: {
115
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
116
+ title?: string | undefined;
117
+ severity?: "minor" | "major" | "critical" | undefined;
118
+ rule?: string | undefined;
119
+ file?: string | undefined;
120
+ startLine?: number | undefined;
121
+ endLine?: number | undefined;
122
+ details?: string | undefined;
123
+ recommendation?: string | undefined;
124
+ }[];
125
+ verdict: "PASS" | "FAIL";
126
+ summary?: string | undefined;
127
+ branch?: string | undefined;
128
+ pullRequestNumber?: number | undefined;
129
+ }, {
130
+ findings: {
131
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
132
+ title?: string | undefined;
133
+ severity?: "minor" | "major" | "critical" | undefined;
134
+ rule?: string | undefined;
135
+ file?: string | undefined;
136
+ startLine?: number | undefined;
137
+ endLine?: number | undefined;
138
+ details?: string | undefined;
139
+ recommendation?: string | undefined;
140
+ }[];
141
+ verdict: "PASS" | "FAIL";
142
+ summary?: string | undefined;
143
+ branch?: string | undefined;
144
+ pullRequestNumber?: number | undefined;
145
+ }>;
146
+ export declare const recordReviewInputSchema: z.ZodObject<{
147
+ verdict: z.ZodEnum<["PASS", "FAIL"]>;
148
+ summary: z.ZodOptional<z.ZodString>;
149
+ branch: z.ZodOptional<z.ZodString>;
150
+ pullRequestNumber: z.ZodOptional<z.ZodNumber>;
151
+ findings: z.ZodArray<z.ZodEffects<z.ZodObject<{
152
+ title: z.ZodOptional<z.ZodString>;
153
+ severity: z.ZodOptional<z.ZodEnum<["minor", "major", "critical"]>>;
154
+ status: z.ZodOptional<z.ZodEnum<["blocking", "non-blocking", "accepted-risk"]>>;
155
+ rule: z.ZodOptional<z.ZodString>;
156
+ file: z.ZodOptional<z.ZodString>;
157
+ startLine: z.ZodOptional<z.ZodNumber>;
158
+ endLine: z.ZodOptional<z.ZodNumber>;
159
+ details: z.ZodOptional<z.ZodString>;
160
+ recommendation: z.ZodOptional<z.ZodString>;
161
+ }, "strict", z.ZodTypeAny, {
162
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
163
+ title?: string | undefined;
164
+ severity?: "minor" | "major" | "critical" | undefined;
165
+ rule?: string | undefined;
166
+ file?: string | undefined;
167
+ startLine?: number | undefined;
168
+ endLine?: number | undefined;
169
+ details?: string | undefined;
170
+ recommendation?: string | undefined;
171
+ }, {
172
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
173
+ title?: string | undefined;
174
+ severity?: "minor" | "major" | "critical" | undefined;
175
+ rule?: string | undefined;
176
+ file?: string | undefined;
177
+ startLine?: number | undefined;
178
+ endLine?: number | undefined;
179
+ details?: string | undefined;
180
+ recommendation?: string | undefined;
181
+ }>, {
182
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
183
+ title?: string | undefined;
184
+ severity?: "minor" | "major" | "critical" | undefined;
185
+ rule?: string | undefined;
186
+ file?: string | undefined;
187
+ startLine?: number | undefined;
188
+ endLine?: number | undefined;
189
+ details?: string | undefined;
190
+ recommendation?: string | undefined;
191
+ }, {
192
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
193
+ title?: string | undefined;
194
+ severity?: "minor" | "major" | "critical" | undefined;
195
+ rule?: string | undefined;
196
+ file?: string | undefined;
197
+ startLine?: number | undefined;
198
+ endLine?: number | undefined;
199
+ details?: string | undefined;
200
+ recommendation?: string | undefined;
201
+ }>, "many">;
202
+ } & {
203
+ reviewType: z.ZodString;
204
+ sourceState: z.ZodOptional<z.ZodString>;
205
+ }, "strict", z.ZodTypeAny, {
206
+ findings: {
207
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
208
+ title?: string | undefined;
209
+ severity?: "minor" | "major" | "critical" | undefined;
210
+ rule?: string | undefined;
211
+ file?: string | undefined;
212
+ startLine?: number | undefined;
213
+ endLine?: number | undefined;
214
+ details?: string | undefined;
215
+ recommendation?: string | undefined;
216
+ }[];
217
+ verdict: "PASS" | "FAIL";
218
+ reviewType: string;
219
+ summary?: string | undefined;
220
+ sourceState?: string | undefined;
221
+ branch?: string | undefined;
222
+ pullRequestNumber?: number | undefined;
223
+ }, {
224
+ findings: {
225
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
226
+ title?: string | undefined;
227
+ severity?: "minor" | "major" | "critical" | undefined;
228
+ rule?: string | undefined;
229
+ file?: string | undefined;
230
+ startLine?: number | undefined;
231
+ endLine?: number | undefined;
232
+ details?: string | undefined;
233
+ recommendation?: string | undefined;
234
+ }[];
235
+ verdict: "PASS" | "FAIL";
236
+ reviewType: string;
237
+ summary?: string | undefined;
238
+ sourceState?: string | undefined;
239
+ branch?: string | undefined;
240
+ pullRequestNumber?: number | undefined;
241
+ }>;
242
+ export declare const storedReviewSchema: z.ZodObject<{
243
+ verdict: z.ZodEnum<["PASS", "FAIL"]>;
244
+ summary: z.ZodOptional<z.ZodString>;
245
+ branch: z.ZodOptional<z.ZodString>;
246
+ pullRequestNumber: z.ZodOptional<z.ZodNumber>;
247
+ findings: z.ZodArray<z.ZodEffects<z.ZodObject<{
248
+ title: z.ZodOptional<z.ZodString>;
249
+ severity: z.ZodOptional<z.ZodEnum<["minor", "major", "critical"]>>;
250
+ status: z.ZodOptional<z.ZodEnum<["blocking", "non-blocking", "accepted-risk"]>>;
251
+ rule: z.ZodOptional<z.ZodString>;
252
+ file: z.ZodOptional<z.ZodString>;
253
+ startLine: z.ZodOptional<z.ZodNumber>;
254
+ endLine: z.ZodOptional<z.ZodNumber>;
255
+ details: z.ZodOptional<z.ZodString>;
256
+ recommendation: z.ZodOptional<z.ZodString>;
257
+ }, "strict", z.ZodTypeAny, {
258
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
259
+ title?: string | undefined;
260
+ severity?: "minor" | "major" | "critical" | undefined;
261
+ rule?: string | undefined;
262
+ file?: string | undefined;
263
+ startLine?: number | undefined;
264
+ endLine?: number | undefined;
265
+ details?: string | undefined;
266
+ recommendation?: string | undefined;
267
+ }, {
268
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
269
+ title?: string | undefined;
270
+ severity?: "minor" | "major" | "critical" | undefined;
271
+ rule?: string | undefined;
272
+ file?: string | undefined;
273
+ startLine?: number | undefined;
274
+ endLine?: number | undefined;
275
+ details?: string | undefined;
276
+ recommendation?: string | undefined;
277
+ }>, {
278
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
279
+ title?: string | undefined;
280
+ severity?: "minor" | "major" | "critical" | undefined;
281
+ rule?: string | undefined;
282
+ file?: string | undefined;
283
+ startLine?: number | undefined;
284
+ endLine?: number | undefined;
285
+ details?: string | undefined;
286
+ recommendation?: string | undefined;
287
+ }, {
288
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
289
+ title?: string | undefined;
290
+ severity?: "minor" | "major" | "critical" | undefined;
291
+ rule?: string | undefined;
292
+ file?: string | undefined;
293
+ startLine?: number | undefined;
294
+ endLine?: number | undefined;
295
+ details?: string | undefined;
296
+ recommendation?: string | undefined;
297
+ }>, "many">;
298
+ } & {
299
+ reviewType: z.ZodString;
300
+ sourceState: z.ZodOptional<z.ZodString>;
301
+ } & {
302
+ id: z.ZodNumber;
303
+ sessionId: z.ZodString;
304
+ createdAt: z.ZodString;
305
+ }, "strict", z.ZodTypeAny, {
306
+ findings: {
307
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
308
+ title?: string | undefined;
309
+ severity?: "minor" | "major" | "critical" | undefined;
310
+ rule?: string | undefined;
311
+ file?: string | undefined;
312
+ startLine?: number | undefined;
313
+ endLine?: number | undefined;
314
+ details?: string | undefined;
315
+ recommendation?: string | undefined;
316
+ }[];
317
+ id: number;
318
+ sessionId: string;
319
+ createdAt: string;
320
+ verdict: "PASS" | "FAIL";
321
+ reviewType: string;
322
+ summary?: string | undefined;
323
+ sourceState?: string | undefined;
324
+ branch?: string | undefined;
325
+ pullRequestNumber?: number | undefined;
326
+ }, {
327
+ findings: {
328
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
329
+ title?: string | undefined;
330
+ severity?: "minor" | "major" | "critical" | undefined;
331
+ rule?: string | undefined;
332
+ file?: string | undefined;
333
+ startLine?: number | undefined;
334
+ endLine?: number | undefined;
335
+ details?: string | undefined;
336
+ recommendation?: string | undefined;
337
+ }[];
338
+ id: number;
339
+ sessionId: string;
340
+ createdAt: string;
341
+ verdict: "PASS" | "FAIL";
342
+ reviewType: string;
343
+ summary?: string | undefined;
344
+ sourceState?: string | undefined;
345
+ branch?: string | undefined;
346
+ pullRequestNumber?: number | undefined;
347
+ }>;
348
+ export declare const listedReviewSchema: z.ZodObject<{
349
+ verdict: z.ZodEnum<["PASS", "FAIL"]>;
350
+ summary: z.ZodOptional<z.ZodString>;
351
+ branch: z.ZodOptional<z.ZodString>;
352
+ pullRequestNumber: z.ZodOptional<z.ZodNumber>;
353
+ findings: z.ZodArray<z.ZodEffects<z.ZodObject<{
354
+ title: z.ZodOptional<z.ZodString>;
355
+ severity: z.ZodOptional<z.ZodEnum<["minor", "major", "critical"]>>;
356
+ status: z.ZodOptional<z.ZodEnum<["blocking", "non-blocking", "accepted-risk"]>>;
357
+ rule: z.ZodOptional<z.ZodString>;
358
+ file: z.ZodOptional<z.ZodString>;
359
+ startLine: z.ZodOptional<z.ZodNumber>;
360
+ endLine: z.ZodOptional<z.ZodNumber>;
361
+ details: z.ZodOptional<z.ZodString>;
362
+ recommendation: z.ZodOptional<z.ZodString>;
363
+ }, "strict", z.ZodTypeAny, {
364
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
365
+ title?: string | undefined;
366
+ severity?: "minor" | "major" | "critical" | undefined;
367
+ rule?: string | undefined;
368
+ file?: string | undefined;
369
+ startLine?: number | undefined;
370
+ endLine?: number | undefined;
371
+ details?: string | undefined;
372
+ recommendation?: string | undefined;
373
+ }, {
374
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
375
+ title?: string | undefined;
376
+ severity?: "minor" | "major" | "critical" | undefined;
377
+ rule?: string | undefined;
378
+ file?: string | undefined;
379
+ startLine?: number | undefined;
380
+ endLine?: number | undefined;
381
+ details?: string | undefined;
382
+ recommendation?: string | undefined;
383
+ }>, {
384
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
385
+ title?: string | undefined;
386
+ severity?: "minor" | "major" | "critical" | undefined;
387
+ rule?: string | undefined;
388
+ file?: string | undefined;
389
+ startLine?: number | undefined;
390
+ endLine?: number | undefined;
391
+ details?: string | undefined;
392
+ recommendation?: string | undefined;
393
+ }, {
394
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
395
+ title?: string | undefined;
396
+ severity?: "minor" | "major" | "critical" | undefined;
397
+ rule?: string | undefined;
398
+ file?: string | undefined;
399
+ startLine?: number | undefined;
400
+ endLine?: number | undefined;
401
+ details?: string | undefined;
402
+ recommendation?: string | undefined;
403
+ }>, "many">;
404
+ } & {
405
+ reviewType: z.ZodString;
406
+ sourceState: z.ZodOptional<z.ZodString>;
407
+ } & {
408
+ id: z.ZodNumber;
409
+ sessionId: z.ZodString;
410
+ createdAt: z.ZodString;
411
+ } & {
412
+ repository: z.ZodOptional<z.ZodString>;
413
+ }, "strict", z.ZodTypeAny, {
414
+ findings: {
415
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
416
+ title?: string | undefined;
417
+ severity?: "minor" | "major" | "critical" | undefined;
418
+ rule?: string | undefined;
419
+ file?: string | undefined;
420
+ startLine?: number | undefined;
421
+ endLine?: number | undefined;
422
+ details?: string | undefined;
423
+ recommendation?: string | undefined;
424
+ }[];
425
+ id: number;
426
+ sessionId: string;
427
+ createdAt: string;
428
+ verdict: "PASS" | "FAIL";
429
+ reviewType: string;
430
+ summary?: string | undefined;
431
+ sourceState?: string | undefined;
432
+ branch?: string | undefined;
433
+ pullRequestNumber?: number | undefined;
434
+ repository?: string | undefined;
435
+ }, {
436
+ findings: {
437
+ status?: "blocking" | "non-blocking" | "accepted-risk" | undefined;
438
+ title?: string | undefined;
439
+ severity?: "minor" | "major" | "critical" | undefined;
440
+ rule?: string | undefined;
441
+ file?: string | undefined;
442
+ startLine?: number | undefined;
443
+ endLine?: number | undefined;
444
+ details?: string | undefined;
445
+ recommendation?: string | undefined;
446
+ }[];
447
+ id: number;
448
+ sessionId: string;
449
+ createdAt: string;
450
+ verdict: "PASS" | "FAIL";
451
+ reviewType: string;
452
+ summary?: string | undefined;
453
+ sourceState?: string | undefined;
454
+ branch?: string | undefined;
455
+ pullRequestNumber?: number | undefined;
456
+ repository?: string | undefined;
457
+ }>;
458
+ export declare const reviewFiltersSchema: z.ZodObject<{
459
+ repository: z.ZodOptional<z.ZodString>;
460
+ branch: z.ZodOptional<z.ZodString>;
461
+ pullRequestNumber: z.ZodOptional<z.ZodNumber>;
462
+ reviewType: z.ZodOptional<z.ZodString>;
463
+ verdict: z.ZodOptional<z.ZodEnum<["PASS", "FAIL"]>>;
464
+ }, "strict", z.ZodTypeAny, {
465
+ verdict?: "PASS" | "FAIL" | undefined;
466
+ branch?: string | undefined;
467
+ pullRequestNumber?: number | undefined;
468
+ reviewType?: string | undefined;
469
+ repository?: string | undefined;
470
+ }, {
471
+ verdict?: "PASS" | "FAIL" | undefined;
472
+ branch?: string | undefined;
473
+ pullRequestNumber?: number | undefined;
474
+ reviewType?: string | undefined;
475
+ repository?: string | undefined;
476
+ }>;
477
+ /** @riviere-role value-object */
478
+ export type ReviewType = z.infer<typeof reviewTypeSchema>;
479
+ /** @riviere-role value-object */
480
+ export type ReviewVerdict = z.infer<typeof reviewVerdictSchema>;
481
+ /** @riviere-role value-object */
482
+ export type ReviewFindingSeverity = z.infer<typeof reviewFindingSeveritySchema>;
483
+ /** @riviere-role value-object */
484
+ export type ReviewFindingStatus = z.infer<typeof reviewFindingStatusSchema>;
485
+ /** @riviere-role value-object */
486
+ export type ReviewFinding = z.infer<typeof reviewFindingSchema>;
487
+ /** @riviere-role value-object */
488
+ export type ReviewPayload = z.infer<typeof reviewPayloadSchema>;
489
+ /** @riviere-role value-object */
490
+ export type RecordReviewInput = z.infer<typeof recordReviewInputSchema>;
491
+ /** @riviere-role value-object */
492
+ export type StoredReview = z.infer<typeof storedReviewSchema>;
493
+ /** @riviere-role value-object */
494
+ export type ListedReview = z.infer<typeof listedReviewSchema>;
495
+ /** @riviere-role value-object */
496
+ export type ReviewFilters = z.infer<typeof reviewFiltersSchema>;
@@ -0,0 +1,62 @@
1
+ import { z } from 'zod';
2
+ export const reviewTypeSchema = z.string().min(1);
3
+ export const reviewVerdictSchema = z.enum(['PASS', 'FAIL']);
4
+ export const reviewFindingSeveritySchema = z.enum(['minor', 'major', 'critical']);
5
+ export const reviewFindingStatusSchema = z.enum(['blocking', 'non-blocking', 'accepted-risk']);
6
+ export const reviewFindingSchema = z.object({
7
+ title: z.string().min(1).optional(),
8
+ severity: reviewFindingSeveritySchema.optional(),
9
+ status: reviewFindingStatusSchema.optional(),
10
+ rule: z.string().min(1).optional(),
11
+ file: z.string().min(1).optional(),
12
+ startLine: z.number().int().positive().optional(),
13
+ endLine: z.number().int().positive().optional(),
14
+ details: z.string().min(1).optional(),
15
+ recommendation: z.string().min(1).optional(),
16
+ }).strict().superRefine((finding, context) => {
17
+ if (finding.title === undefined && finding.details === undefined && finding.rule === undefined) {
18
+ context.addIssue({
19
+ code: z.ZodIssueCode.custom,
20
+ message: 'Expected review finding to include at least one of title, details, or rule.',
21
+ path: ['title'],
22
+ });
23
+ }
24
+ if (finding.endLine !== undefined && finding.startLine === undefined) {
25
+ context.addIssue({
26
+ code: z.ZodIssueCode.custom,
27
+ message: 'Expected startLine when endLine is provided.',
28
+ path: ['startLine'],
29
+ });
30
+ }
31
+ if (finding.startLine !== undefined && finding.endLine !== undefined && finding.endLine < finding.startLine) {
32
+ context.addIssue({
33
+ code: z.ZodIssueCode.custom,
34
+ message: 'Expected endLine to be greater than or equal to startLine.',
35
+ path: ['endLine'],
36
+ });
37
+ }
38
+ });
39
+ export const reviewPayloadSchema = z.object({
40
+ verdict: reviewVerdictSchema,
41
+ summary: z.string().min(1).optional(),
42
+ branch: z.string().min(1).optional(),
43
+ pullRequestNumber: z.number().int().positive().optional(),
44
+ findings: z.array(reviewFindingSchema),
45
+ }).strict();
46
+ export const recordReviewInputSchema = reviewPayloadSchema.extend({
47
+ reviewType: reviewTypeSchema,
48
+ sourceState: z.string().min(1).optional(),
49
+ }).strict();
50
+ export const storedReviewSchema = recordReviewInputSchema.extend({
51
+ id: z.number().int().positive(),
52
+ sessionId: z.string().min(1),
53
+ createdAt: z.string().min(1),
54
+ }).strict();
55
+ export const listedReviewSchema = storedReviewSchema.extend({ repository: z.string().min(1).optional() }).strict();
56
+ export const reviewFiltersSchema = z.object({
57
+ repository: z.string().min(1).optional(),
58
+ branch: z.string().min(1).optional(),
59
+ pullRequestNumber: z.number().int().positive().optional(),
60
+ reviewType: reviewTypeSchema.optional(),
61
+ verdict: reviewVerdictSchema.optional(),
62
+ }).strict();
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,26 @@
1
+ import { describe, expect, it, } from 'vitest';
2
+ import { reviewFindingSchema } from './review-types.js';
3
+ describe('reviewFindingSchema', () => {
4
+ it('rejects empty finding records', () => {
5
+ const result = reviewFindingSchema.safeParse({});
6
+ expect(result.success).toBe(false);
7
+ });
8
+ it('rejects end line before start line', () => {
9
+ const result = reviewFindingSchema.safeParse({
10
+ title: 'Invalid range',
11
+ startLine: 10,
12
+ endLine: 9,
13
+ });
14
+ expect(result.success).toBe(false);
15
+ });
16
+ it('accepts finding records with a title and single start line', () => {
17
+ const result = reviewFindingSchema.parse({
18
+ title: 'Missing test',
19
+ startLine: 10,
20
+ });
21
+ expect(result).toStrictEqual({
22
+ title: 'Missing test',
23
+ startLine: 10,
24
+ });
25
+ });
26
+ });
@@ -1,6 +1,7 @@
1
1
  import type { ZodType } from 'zod';
2
2
  import type { BaseEvent } from './base-event';
3
3
  import type { RecordReflectionInput, StoredReflection } from './reflection-types';
4
+ import type { ListedReview, RecordReviewInput, ReviewFilters, StoredReview } from './review-types';
4
5
  import type { StoredEvent } from './stored-event';
5
6
  import type { PreconditionResult } from './precondition-result';
6
7
  import type { TranscriptReader } from '../infra/external-clients/transcript/transcript-reader';
@@ -47,6 +48,10 @@ export interface WorkflowEventStore {
47
48
  hasSessionStarted(sessionId: string): boolean;
48
49
  recordReflection(sessionId: string, createdAt: string, input: RecordReflectionInput): StoredReflection;
49
50
  listReflections(sessionId: string): readonly StoredReflection[];
51
+ recordReview(sessionId: string, createdAt: string, input: RecordReviewInput): StoredReview;
52
+ recordReviewWithEvent(sessionId: string, createdAt: string, input: RecordReviewInput, eventState: string): StoredReview;
53
+ listSessionReviews(sessionId: string): readonly StoredReview[];
54
+ listReviews(filters: ReviewFilters): readonly ListedReview[];
50
55
  }
51
56
  /** @riviere-role value-object */
52
57
  export type WorkflowEngineDeps = {
@@ -5,7 +5,9 @@ export const JOURNAL_GUIDANCE = [
5
5
  'PLATFORM NOTIFICATION',
6
6
  '',
7
7
  'Record your progress and reasoning as you work by calling:',
8
- ' write-journal <agent-name> "<1\u20133 sentence note>"',
8
+ ' <workflow-command> write-journal <agent-name> "<detailed journal entry>"',
9
+ '',
10
+ 'Use the same workflow command prefix used for other workflow commands such as transition.',
9
11
  '',
10
12
  'Use it for key decisions, progress milestones, and blockers.',
11
13
  'Every session should have a journal trail of the work performed.',
@@ -59,6 +59,9 @@ class ReflectionStoreNotConfiguredError extends Error {
59
59
  this.name = 'ReflectionStoreNotConfiguredError';
60
60
  }
61
61
  }
62
+ function throwStoreNotConfigured() {
63
+ throw new ReflectionStoreNotConfiguredError();
64
+ }
62
65
  class MemoryStore {
63
66
  eventsBySessionId = new Map();
64
67
  readEvents(sessionId) {
@@ -80,11 +83,29 @@ class MemoryStore {
80
83
  void _sessionId;
81
84
  void _createdAt;
82
85
  void _input;
83
- throw new ReflectionStoreNotConfiguredError();
86
+ return throwStoreNotConfigured();
84
87
  }
85
88
  listReflections() {
86
89
  return [];
87
90
  }
91
+ recordReview(_sessionId, _createdAt, _input) {
92
+ return this.recordReviewWithEvent(_sessionId, _createdAt, _input, 'unconfigured');
93
+ }
94
+ recordReviewWithEvent(_sessionId, _createdAt, _input, _eventState) {
95
+ void _sessionId;
96
+ void _createdAt;
97
+ void _input;
98
+ void _eventState;
99
+ return throwStoreNotConfigured();
100
+ }
101
+ listSessionReviews(_sessionId) {
102
+ void _sessionId;
103
+ return [];
104
+ }
105
+ listReviews(_filters) {
106
+ void _filters;
107
+ return [];
108
+ }
88
109
  }
89
110
  const procedureContent = 'PLANNING instructions';
90
111
  const workflowDefinition = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nt-ai-lab/deterministic-agent-workflow-engine",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "exports": {