@codraoss/core 0.9.4

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.
Files changed (80) hide show
  1. package/LICENSE +625 -0
  2. package/README.md +15 -0
  3. package/dist/chunk-FGXA7JNR.js +57 -0
  4. package/dist/chunk-FGXA7JNR.js.map +1 -0
  5. package/dist/chunk-ILZUCIZH.js +117 -0
  6. package/dist/chunk-ILZUCIZH.js.map +1 -0
  7. package/dist/chunk-JC74XH7Q.js +67 -0
  8. package/dist/chunk-JC74XH7Q.js.map +1 -0
  9. package/dist/chunk-MMVQPGK3.js +341 -0
  10. package/dist/chunk-MMVQPGK3.js.map +1 -0
  11. package/dist/chunk-NSTV4TRP.js +39 -0
  12. package/dist/chunk-NSTV4TRP.js.map +1 -0
  13. package/dist/chunk-OIQRTDYR.js +337 -0
  14. package/dist/chunk-OIQRTDYR.js.map +1 -0
  15. package/dist/chunk-PVXFURDR.js +90 -0
  16. package/dist/chunk-PVXFURDR.js.map +1 -0
  17. package/dist/chunk-R2HRWFRH.js +108 -0
  18. package/dist/chunk-R2HRWFRH.js.map +1 -0
  19. package/dist/chunk-RQ5S67XB.js +82 -0
  20. package/dist/chunk-RQ5S67XB.js.map +1 -0
  21. package/dist/chunk-U3VKVDZ7.js +266 -0
  22. package/dist/chunk-U3VKVDZ7.js.map +1 -0
  23. package/dist/chunk-V3RF6GQW.js +137 -0
  24. package/dist/chunk-V3RF6GQW.js.map +1 -0
  25. package/dist/chunk-WSK45HW4.js +79 -0
  26. package/dist/chunk-WSK45HW4.js.map +1 -0
  27. package/dist/chunk-XD6CGYHO.js +893 -0
  28. package/dist/chunk-XD6CGYHO.js.map +1 -0
  29. package/dist/claim-checks.d.ts +54 -0
  30. package/dist/claim-checks.js +20 -0
  31. package/dist/claim-checks.js.map +1 -0
  32. package/dist/diff/index.d.ts +22 -0
  33. package/dist/diff/index.js +25 -0
  34. package/dist/diff/index.js.map +1 -0
  35. package/dist/fingerprint.d.ts +9 -0
  36. package/dist/fingerprint.js +19 -0
  37. package/dist/fingerprint.js.map +1 -0
  38. package/dist/index-BTDWXDck.d.ts +93 -0
  39. package/dist/index.d.ts +138 -0
  40. package/dist/index.js +1755 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/logger.d.ts +32 -0
  43. package/dist/logger.js +17 -0
  44. package/dist/logger.js.map +1 -0
  45. package/dist/model-gRDTk8yk.d.ts +117 -0
  46. package/dist/model-output/index.d.ts +4 -0
  47. package/dist/model-output/index.js +32 -0
  48. package/dist/model-output/index.js.map +1 -0
  49. package/dist/ports/index.d.ts +512 -0
  50. package/dist/ports/index.js +13 -0
  51. package/dist/ports/index.js.map +1 -0
  52. package/dist/position-h_jdn6ZH.d.ts +30 -0
  53. package/dist/prompts/file-review.d.ts +6 -0
  54. package/dist/prompts/file-review.js +25 -0
  55. package/dist/prompts/file-review.js.map +1 -0
  56. package/dist/prompts/languages.d.ts +9 -0
  57. package/dist/prompts/languages.js +7 -0
  58. package/dist/prompts/languages.js.map +1 -0
  59. package/dist/prompts/summary.d.ts +12 -0
  60. package/dist/prompts/summary.js +50 -0
  61. package/dist/prompts/summary.js.map +1 -0
  62. package/dist/prompts/verify.d.ts +71 -0
  63. package/dist/prompts/verify.js +15 -0
  64. package/dist/prompts/verify.js.map +1 -0
  65. package/dist/rules/detect.d.ts +32 -0
  66. package/dist/rules/detect.js +13 -0
  67. package/dist/rules/detect.js.map +1 -0
  68. package/dist/rules/table.d.ts +18 -0
  69. package/dist/rules/table.js +7 -0
  70. package/dist/rules/table.js.map +1 -0
  71. package/dist/timeout.d.ts +6 -0
  72. package/dist/timeout.js +26 -0
  73. package/dist/timeout.js.map +1 -0
  74. package/dist/token-tracker.d.ts +38 -0
  75. package/dist/token-tracker.js +8 -0
  76. package/dist/token-tracker.js.map +1 -0
  77. package/dist/verify.d.ts +3 -0
  78. package/dist/verify.js +21 -0
  79. package/dist/verify.js.map +1 -0
  80. package/package.json +181 -0
@@ -0,0 +1,512 @@
1
+ import { JobSummary, RepoConfig, ParsedReviewComment, ClaimType, ReviewSettings, ReviewJobMessage } from '@codraoss/schema';
2
+ import { R as ReviewModel, M as ModelErrorClassifier } from '../model-gRDTk8yk.js';
3
+ export { F as FileReviewOutcome, a as ModelResponse, b as ModelResponseSchema } from '../model-gRDTk8yk.js';
4
+ import { TokenTracker } from '../token-tracker.js';
5
+ export { Logger } from '../logger.js';
6
+ import '../position-h_jdn6ZH.js';
7
+ import '../index-BTDWXDck.js';
8
+ import 'zod';
9
+ import '../prompts/verify.js';
10
+
11
+ interface KvStore {
12
+ get(key: string): Promise<string | null>;
13
+ put(key: string, value: string, options?: {
14
+ expirationTtl?: number;
15
+ }): Promise<void>;
16
+ }
17
+ interface Clock {
18
+ now(): number;
19
+ }
20
+ interface IdGenerator {
21
+ randomUUID(): string;
22
+ }
23
+ interface SecretStore {
24
+ getSecret(key: string): Promise<string | null>;
25
+ }
26
+
27
+ type PersistedReviewJob = JobSummary;
28
+ type JobRow = {
29
+ status: 'queued' | 'running' | 'done' | 'failed' | 'superseded' | 'cancelled' | 'stopped';
30
+ check_run_id: number | null;
31
+ [column: string]: unknown;
32
+ };
33
+ type JobLeaseClaim = {
34
+ status: 'claimed';
35
+ row: JobRow;
36
+ } | {
37
+ status: 'busy';
38
+ row: JobRow;
39
+ retryAfterSeconds: number;
40
+ } | {
41
+ status: 'terminal';
42
+ row: JobRow;
43
+ } | {
44
+ status: 'missing';
45
+ };
46
+ interface JobStore {
47
+ mapJob(row: JobRow): PersistedReviewJob;
48
+ getJobForProcessing(jobId: string): Promise<JobRow | null>;
49
+ claimJobLease(jobId: string, leaseOwner: string, leaseSeconds: number): Promise<JobLeaseClaim>;
50
+ heartbeatJobLease(jobId: string, leaseOwner: string, leaseSeconds: number): Promise<void>;
51
+ releaseJobLease(jobId: string, leaseOwner: string): Promise<void>;
52
+ markJobContinuationQueued(jobId: string, delaySeconds?: number): Promise<number>;
53
+ resetJobContinuationCount(jobId: string): Promise<void>;
54
+ getOtherRunningJobsCount(excludeJobId: string): Promise<number>;
55
+ setJobWorkflowInstance(jobId: string, workflowInstanceId: string): Promise<void>;
56
+ setJobPullRequestMeta(jobId: string, meta: {
57
+ prTitle: string | null;
58
+ prAuthor: string | null;
59
+ }): Promise<void>;
60
+ insertJob(input: {
61
+ installationId: string;
62
+ owner: string;
63
+ repo: string;
64
+ prNumber: number;
65
+ prTitle: string | null;
66
+ prAuthor: string | null;
67
+ commitSha: string;
68
+ baseSha: string;
69
+ trigger: 'auto' | 'mention' | 'retry';
70
+ headRef: string | null;
71
+ baseRef: string | null;
72
+ configSnapshot?: RepoConfig | null;
73
+ retryOfJobId?: string | null;
74
+ }): Promise<PersistedReviewJob>;
75
+ findExistingJobForHead(input: {
76
+ owner: string;
77
+ repo: string;
78
+ prNumber: number;
79
+ commitSha: string;
80
+ trigger: 'auto' | 'mention';
81
+ }): Promise<PersistedReviewJob | null>;
82
+ recoverExpiredJobLeases(maxCount: number): Promise<{
83
+ requeuedJobIds: string[];
84
+ failedJobs: Array<{
85
+ id: string;
86
+ }>;
87
+ }>;
88
+ getTerminalJobsNeedingCheckRunCompletion(limit: number): Promise<Array<{
89
+ id: string;
90
+ status: string;
91
+ check_run_id: number | null;
92
+ installation_id: string;
93
+ owner: string;
94
+ repo: string;
95
+ verdict: string | null;
96
+ file_count: number | null;
97
+ comment_count: number | null;
98
+ error_msg: string | null;
99
+ }>>;
100
+ hasPendingMaintenanceWork(): Promise<boolean>;
101
+ clearSystemActive(): Promise<void>;
102
+ updateJobCheckRun(jobId: string, checkRunId: number): Promise<void>;
103
+ markJobCheckRunCompleted(jobId: string): Promise<void>;
104
+ completePreparationStep(jobId: string, fileCount: number): Promise<void>;
105
+ updateJobStep(jobId: string, stepName: string, update: {
106
+ status: 'pending' | 'running' | 'done' | 'failed';
107
+ startedAt?: string | null;
108
+ finishedAt?: string | null;
109
+ error?: string | null;
110
+ }): Promise<void>;
111
+ completeJob(jobId: string, input: {
112
+ verdict: 'approve' | 'comment';
113
+ fileCount: number;
114
+ commentCount: number;
115
+ totalInputTokens: number;
116
+ totalOutputTokens: number;
117
+ summaryMarkdown: string;
118
+ reviewId: number | null;
119
+ summaryModel: string | null;
120
+ overallConfidenceScore?: number | null;
121
+ errorMessage?: string | null;
122
+ }): Promise<void>;
123
+ failJob(jobId: string, errorMessage: string): Promise<void>;
124
+ supersedeOlderJobs(input: {
125
+ installationId: string;
126
+ owner: string;
127
+ repo: string;
128
+ prNumber: number;
129
+ newJobId: string;
130
+ }): Promise<number>;
131
+ }
132
+
133
+ type FileReviewRow = {
134
+ id: string;
135
+ job_id: string;
136
+ file_path: string;
137
+ file_status: 'pending' | 'done' | 'skipped' | 'failed';
138
+ model_used: string;
139
+ diff_line_count: number;
140
+ diff_input: string | null;
141
+ raw_ai_output: string | null;
142
+ parsed_comments: ParsedReviewComment[];
143
+ input_tokens: number | null;
144
+ output_tokens: number | null;
145
+ duration_ms: number | null;
146
+ verdict: 'approve' | 'comment' | null;
147
+ file_summary: string | null;
148
+ overall_correctness: string | null;
149
+ confidence_score: number | null;
150
+ error_msg: string | null;
151
+ model_provider: string | null;
152
+ transient_error_count: number;
153
+ async_request_id: string | null;
154
+ async_model: string | null;
155
+ withheld_counts: {
156
+ evidence?: number;
157
+ claimDenied?: number;
158
+ };
159
+ batch_size: number | null;
160
+ };
161
+ type SuppressedFinding = {
162
+ fingerprint: string | null;
163
+ anchor_hash: string | null;
164
+ fingerprint_v2: string | null;
165
+ anchored: boolean;
166
+ };
167
+ type BulkFileReviewInput = {
168
+ filePath: string;
169
+ fileStatus: 'pending' | 'done' | 'skipped' | 'failed';
170
+ modelUsed: string;
171
+ modelProvider?: string | null;
172
+ diffLineCount: number;
173
+ rawAiOutput: string | null;
174
+ parsedComments: ParsedReviewComment[];
175
+ inputTokens: number | null;
176
+ outputTokens: number | null;
177
+ durationMs: number | null;
178
+ verdict: 'approve' | 'comment' | null;
179
+ fileSummary: string | null;
180
+ overallCorrectness?: string | null;
181
+ confidenceScore?: number | null;
182
+ errorMessage: string | null;
183
+ withheldCounts?: {
184
+ evidence: number;
185
+ claimDenied: number;
186
+ } | null;
187
+ batchSize: number;
188
+ };
189
+ interface FileReviewStore {
190
+ upsertFileReview(jobId: string, input: {
191
+ filePath: string;
192
+ fileStatus: 'pending' | 'done' | 'skipped' | 'failed';
193
+ modelUsed: string;
194
+ modelProvider?: string | null;
195
+ diffLineCount: number;
196
+ diffInput: string | null;
197
+ rawAiOutput: string | null;
198
+ parsedComments: ParsedReviewComment[];
199
+ inputTokens: number | null;
200
+ outputTokens: number | null;
201
+ durationMs: number | null;
202
+ verdict: 'approve' | 'comment' | null;
203
+ fileSummary: string | null;
204
+ overallCorrectness?: string | null;
205
+ confidenceScore?: number | null;
206
+ errorMessage: string | null;
207
+ withheldCounts?: {
208
+ evidence: number;
209
+ claimDenied: number;
210
+ } | null;
211
+ asyncRequestId?: string | null;
212
+ asyncModel?: string | null;
213
+ }): Promise<void>;
214
+ recordRetryableFileReviewFailure(jobId: string, input: {
215
+ filePath: string;
216
+ modelUsed: string;
217
+ modelProvider?: string | null;
218
+ diffLineCount: number;
219
+ diffInput: string | null;
220
+ durationMs: number | null;
221
+ errorMessage: string;
222
+ countsAsAttempt?: boolean;
223
+ }): Promise<number>;
224
+ getFileReviewsForJobs(jobIds: string[]): Promise<FileReviewRow[]>;
225
+ bulkInheritFileReviews(input: {
226
+ jobId: string;
227
+ parentJobId: string;
228
+ filePaths: string[];
229
+ }): Promise<string[]>;
230
+ bulkUpsertFileReviews(jobId: string, inputs: BulkFileReviewInput[]): Promise<void>;
231
+ bulkRecordRetryableFileReviewFailures(jobId: string, inputs: Array<{
232
+ filePath: string;
233
+ modelUsed: string;
234
+ diffLineCount: number;
235
+ errorMessage: string;
236
+ }>, opts?: {
237
+ countsAsAttempt?: boolean;
238
+ }): Promise<Array<{
239
+ filePath: string;
240
+ transientErrorCount: number;
241
+ }>>;
242
+ bulkMarkFilesFailed(jobId: string, files: Array<{
243
+ filePath: string;
244
+ diffLineCount: number;
245
+ }>, opts: {
246
+ modelUsed: string;
247
+ errorMessage: string;
248
+ }): Promise<void>;
249
+ getSuppressedFindings(jobId: string): Promise<SuppressedFinding[]>;
250
+ markCommentsPosted(jobId: string, fingerprints: string[]): Promise<void>;
251
+ markCommentDispositions(jobId: string, byFingerprint: Map<string, {
252
+ disposition: string | null;
253
+ reason: string | null;
254
+ }>): Promise<void>;
255
+ }
256
+
257
+ interface ReviewSettingsReader {
258
+ getReviewSettings(): Promise<ReviewSettings>;
259
+ }
260
+ interface RepoConfigLoader {
261
+ loadRepoConfig(input: {
262
+ installationId: string;
263
+ owner: string;
264
+ repo: string;
265
+ }): Promise<{
266
+ parsedJson: RepoConfig;
267
+ enabled: boolean;
268
+ }>;
269
+ }
270
+ interface ModelConfigReader {
271
+ getResolvedModelConfig(modelId: string): Promise<{
272
+ providerName: string;
273
+ } | null>;
274
+ }
275
+ interface WebhookDeliveryReader {
276
+ getWebhookDelivery(deliveryId: string): Promise<{
277
+ delivery_id: string;
278
+ event_name: string;
279
+ payload: unknown;
280
+ } | null>;
281
+ }
282
+ interface LearningStore {
283
+ getRepositoryIdForJob(jobId: string): Promise<number | null>;
284
+ getRejectedExemplars(input: {
285
+ repositoryId: number;
286
+ claimTypes?: readonly ClaimType[];
287
+ limit?: number;
288
+ }): Promise<Array<{
289
+ title: string;
290
+ body: string;
291
+ claim_type: ClaimType | null;
292
+ context_snippet: string | null;
293
+ path: string;
294
+ }>>;
295
+ }
296
+
297
+ /** Maps to GitHub Pull Request, GitLab Merge Request, etc. */
298
+ type PullRequestRecord = {
299
+ number: number;
300
+ title: string | null;
301
+ body: string | null;
302
+ draft: boolean;
303
+ head: {
304
+ sha: string;
305
+ ref: string;
306
+ };
307
+ base: {
308
+ sha: string;
309
+ ref: string;
310
+ };
311
+ user: {
312
+ login: string;
313
+ };
314
+ };
315
+ type ReviewComment = {
316
+ path: string;
317
+ line?: number;
318
+ side?: 'LEFT' | 'RIGHT';
319
+ position?: number;
320
+ body: string;
321
+ };
322
+ /** @see ReviewGitProvider — the GitHub adapter's name for this port */
323
+ interface ReviewGitProvider {
324
+ getPullRequest(owner: string, repo: string, prNumber: number): Promise<PullRequestRecord>;
325
+ getPullRequestDiff(owner: string, repo: string, prNumber: number): Promise<string>;
326
+ getCompareDiff(owner: string, repo: string, base: string, head: string): Promise<string>;
327
+ createCheckRun(owner: string, repo: string, params: {
328
+ headSha: string;
329
+ title: string;
330
+ summary: string;
331
+ }): Promise<{
332
+ id: number;
333
+ }>;
334
+ updateCheckRun(owner: string, repo: string, checkRunId: number, params: {
335
+ title: string;
336
+ summary: string;
337
+ status?: 'in_progress' | 'completed';
338
+ conclusion?: 'success' | 'neutral' | 'failure' | 'cancelled';
339
+ }): Promise<unknown>;
340
+ createReview(owner: string, repo: string, prNumber: number, params: {
341
+ commitSha: string;
342
+ event: 'APPROVE' | 'COMMENT';
343
+ body: string;
344
+ comments: ReviewComment[];
345
+ }): Promise<{
346
+ id: number;
347
+ postedIndices?: number[];
348
+ }>;
349
+ findBotReviewForCommit(owner: string, repo: string, prNumber: number, commitSha: string, botLogin: string): Promise<{
350
+ id: number;
351
+ } | null>;
352
+ ensureLabel(owner: string, repo: string, name: string, color: string): Promise<unknown>;
353
+ addIssueLabels(owner: string, repo: string, prNumber: number, labels: string[]): Promise<unknown>;
354
+ removeIssueLabelsIfPresent(owner: string, repo: string, prNumber: number, labels: string[]): Promise<unknown>;
355
+ }
356
+ interface GitProviderFactory {
357
+ forInstallation(installationId: string): ReviewGitProvider;
358
+ }
359
+
360
+ interface ReviewFormatter {
361
+ toReviewEvent(verdict: 'approve' | 'comment'): 'APPROVE' | 'COMMENT';
362
+ summarizeVerdict(comments: ParsedReviewComment[], hasFailures: boolean): {
363
+ verdict: 'approve' | 'comment';
364
+ errors: number;
365
+ warnings: number;
366
+ };
367
+ formatInlineComment(comment: ParsedReviewComment): string;
368
+ formatReviewOverview(commitSha: string, botUsername: string): string;
369
+ }
370
+
371
+ type ReviewTelemetryEvent = {
372
+ linesReviewed: number;
373
+ findingsReported: number;
374
+ inputTokens: number;
375
+ outputTokens: number;
376
+ modelsUsed: string[];
377
+ fileExtensions: string[];
378
+ triggerType: string;
379
+ reviewDurationMs: number;
380
+ filesReviewed: number;
381
+ verdict?: string;
382
+ severityDistribution: Record<string, number>;
383
+ concurrencyLevel: string;
384
+ prTotalLinesChanged: number;
385
+ retryCount: number;
386
+ };
387
+ interface TelemetrySink {
388
+ send(event: ReviewTelemetryEvent): Promise<void>;
389
+ }
390
+
391
+ interface ReviewRuntime {
392
+ kv: KvStore;
393
+ clock: Clock;
394
+ ids: IdGenerator;
395
+ botUsername: string;
396
+ jobs: JobStore;
397
+ fileReviews: FileReviewStore;
398
+ settings: ReviewSettingsReader;
399
+ webhooks: WebhookDeliveryReader;
400
+ learning: LearningStore;
401
+ modelConfigs: ModelConfigReader;
402
+ repoConfig: RepoConfigLoader;
403
+ telemetry: TelemetrySink;
404
+ createTokenTracker(): TokenTracker;
405
+ createGitHub(installationId: string, tracker: TokenTracker): ReviewGitProvider;
406
+ createModel(jobId: string, tracker: TokenTracker): ReviewModel;
407
+ createFormatter(): ReviewFormatter;
408
+ githubClients: GitProviderFactory;
409
+ modelErrors: ModelErrorClassifier;
410
+ }
411
+
412
+ interface RepoConfigStore {
413
+ getRepoConfigRecord(owner: string, repo: string): Promise<{
414
+ parsedJson: RepoConfig;
415
+ enabled: boolean;
416
+ mainModel: string | null;
417
+ fallbackModels: string[] | null;
418
+ sizeOverrides: unknown[] | null;
419
+ } | null>;
420
+ syncRepoConfig(input: {
421
+ installationId: string;
422
+ owner: string;
423
+ repo: string;
424
+ }): Promise<void>;
425
+ }
426
+
427
+ interface InstanceIdStore {
428
+ getOrCreateInstanceId(): Promise<string>;
429
+ }
430
+
431
+ interface KeyValueStore {
432
+ put(key: string, value: string, options?: {
433
+ expirationTtl?: number;
434
+ }): Promise<void>;
435
+ get(key: string, type: 'json'): Promise<unknown>;
436
+ get(key: string, type: 'text'): Promise<string | null>;
437
+ delete(key: string): Promise<void>;
438
+ }
439
+
440
+ interface QueueProducer<T> {
441
+ send(message: T, options?: {
442
+ delaySeconds?: number;
443
+ }): Promise<void>;
444
+ }
445
+
446
+ interface JobOrchestrator {
447
+ startReviewJob(id: string, params: ReviewJobMessage): Promise<void>;
448
+ }
449
+
450
+ interface DashboardSessionUser {
451
+ provider: string;
452
+ providerUserId: string;
453
+ login: string;
454
+ name: string | null;
455
+ avatarUrl: string | null;
456
+ email: string | null;
457
+ signedInAt: string;
458
+ metadata: Record<string, unknown>;
459
+ }
460
+ interface SessionStore {
461
+ createSession(session: DashboardSessionUser): Promise<string>;
462
+ readSession(token: string): Promise<DashboardSessionUser | null>;
463
+ destroySession(token: string): Promise<void>;
464
+ renewSession(token: string): Promise<void>;
465
+ }
466
+
467
+ interface AuthorizationResult {
468
+ identity: DashboardSessionUser;
469
+ }
470
+ interface IdentityProvider {
471
+ /**
472
+ * Generates the URL to redirect the user to for authorization.
473
+ */
474
+ beginAuthorization(redirectUri: string, state: string, env: any): Promise<{
475
+ url: string;
476
+ }>;
477
+ /**
478
+ * Validates the callback parameters and exchanges the authorization code for a profile.
479
+ */
480
+ completeAuthorization(code: string, state: string, expectedState: string, env: any): Promise<AuthorizationResult>;
481
+ }
482
+
483
+ declare class InMemoryKV implements KeyValueStore {
484
+ private store;
485
+ put(key: string, value: string, options?: {
486
+ expirationTtl?: number;
487
+ }): Promise<void>;
488
+ get(key: string, type: 'json' | 'text'): Promise<any>;
489
+ delete(key: string): Promise<void>;
490
+ }
491
+ declare class InMemoryQueue<T> implements QueueProducer<T> {
492
+ messages: Array<{
493
+ message: T;
494
+ delaySeconds?: number;
495
+ }>;
496
+ send(message: T, options?: {
497
+ delaySeconds?: number;
498
+ }): Promise<void>;
499
+ }
500
+ declare class InMemoryOrchestrator implements JobOrchestrator {
501
+ jobs: Map<string, ReviewJobMessage>;
502
+ startReviewJob(id: string, params: ReviewJobMessage): Promise<void>;
503
+ }
504
+ declare class InMemorySessionStore implements SessionStore {
505
+ private kv;
506
+ createSession(session: DashboardSessionUser): Promise<string>;
507
+ readSession(token: string): Promise<DashboardSessionUser | null>;
508
+ destroySession(token: string): Promise<void>;
509
+ renewSession(token: string): Promise<void>;
510
+ }
511
+
512
+ export { type AuthorizationResult, type BulkFileReviewInput, type Clock, type DashboardSessionUser, type FileReviewRow, type FileReviewStore, type GitProviderFactory, type IdGenerator, type IdentityProvider, InMemoryKV, InMemoryOrchestrator, InMemoryQueue, InMemorySessionStore, type InstanceIdStore, type JobLeaseClaim, type JobOrchestrator, type JobRow, type JobStore, type KeyValueStore, type KvStore, type LearningStore, type ModelConfigReader, ModelErrorClassifier, type PersistedReviewJob, type PullRequestRecord, type QueueProducer, type RepoConfigLoader, type RepoConfigStore, type ReviewComment, type ReviewFormatter, type ReviewGitProvider, ReviewModel, type ReviewRuntime, type ReviewSettingsReader, type ReviewTelemetryEvent, type SecretStore, type SessionStore, type SuppressedFinding, type TelemetrySink, type WebhookDeliveryReader };
@@ -0,0 +1,13 @@
1
+ import {
2
+ InMemoryKV,
3
+ InMemoryOrchestrator,
4
+ InMemoryQueue,
5
+ InMemorySessionStore
6
+ } from "../chunk-JC74XH7Q.js";
7
+ export {
8
+ InMemoryKV,
9
+ InMemoryOrchestrator,
10
+ InMemoryQueue,
11
+ InMemorySessionStore
12
+ };
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,30 @@
1
+ type DiffLineKind = 'context' | 'add' | 'del';
2
+ type DiffLine = {
3
+ kind: DiffLineKind;
4
+ content: string;
5
+ oldLineNumber?: number;
6
+ newLineNumber?: number;
7
+ position: number;
8
+ };
9
+ type DiffHunk = {
10
+ header: string;
11
+ lines: DiffLine[];
12
+ };
13
+ type FileDiff = {
14
+ path: string;
15
+ previousPath: string | null;
16
+ isNew: boolean;
17
+ isDeleted: boolean;
18
+ isBinary: boolean;
19
+ lineCount: number;
20
+ hunks: DiffHunk[];
21
+ isTruncated?: boolean;
22
+ originalLineCount?: number;
23
+ };
24
+ declare function getValidNewLines(file: FileDiff): Set<number>;
25
+ declare function getValidPositions(file: FileDiff): Set<number>;
26
+ declare function findPositionForLine(file: FileDiff, lineNumber: number): number | undefined;
27
+ declare function truncateFileDiff(file: FileDiff, maxLines: number): FileDiff;
28
+ declare function chunkFileDiff(file: FileDiff, maxLinesPerChunk: number): FileDiff[];
29
+
30
+ export { type DiffLine as D, type FileDiff as F, type DiffHunk as a, type DiffLineKind as b, chunkFileDiff as c, getValidPositions as d, findPositionForLine as f, getValidNewLines as g, truncateFileDiff as t };
@@ -0,0 +1,6 @@
1
+ import '@codraoss/schema';
2
+ import '../position-h_jdn6ZH.js';
3
+ export { c as RejectedExemplar, d as buildBatchReviewPrompts, e as buildBatchReviewResponseSchema, f as buildFileReviewPrompts, g as buildFileReviewSystemPrompt, h as buildFileReviewSystemPromptBase, i as buildReviewResponseSchema, j as fileReviewSystemPromptBase, k as generatorFindingCap, r as renderFileDiff } from '../model-gRDTk8yk.js';
4
+ import '../index-BTDWXDck.js';
5
+ import 'zod';
6
+ import './verify.js';
@@ -0,0 +1,25 @@
1
+ import {
2
+ buildBatchReviewPrompts,
3
+ buildBatchReviewResponseSchema,
4
+ buildFileReviewPrompts,
5
+ buildFileReviewSystemPrompt,
6
+ buildFileReviewSystemPromptBase,
7
+ buildReviewResponseSchema,
8
+ fileReviewSystemPromptBase,
9
+ generatorFindingCap,
10
+ renderFileDiff
11
+ } from "../chunk-MMVQPGK3.js";
12
+ import "../chunk-RQ5S67XB.js";
13
+ import "../chunk-FGXA7JNR.js";
14
+ export {
15
+ buildBatchReviewPrompts,
16
+ buildBatchReviewResponseSchema,
17
+ buildFileReviewPrompts,
18
+ buildFileReviewSystemPrompt,
19
+ buildFileReviewSystemPromptBase,
20
+ buildReviewResponseSchema,
21
+ fileReviewSystemPromptBase,
22
+ generatorFindingCap,
23
+ renderFileDiff
24
+ };
25
+ //# sourceMappingURL=file-review.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,9 @@
1
+ type LanguageGuideline = {
2
+ language: string;
3
+ extensions: string[];
4
+ guidelines: string[];
5
+ persona?: string;
6
+ };
7
+ declare function getLanguageForFile(path: string): LanguageGuideline | undefined;
8
+
9
+ export { type LanguageGuideline, getLanguageForFile };
@@ -0,0 +1,7 @@
1
+ import {
2
+ getLanguageForFile
3
+ } from "../chunk-RQ5S67XB.js";
4
+ export {
5
+ getLanguageForFile
6
+ };
7
+ //# sourceMappingURL=languages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,12 @@
1
+ declare const SUMMARY_SYSTEM_PROMPT = "You are an automated code review bot. Summarize the findings of a PR review.\nCRITICAL: Return ONLY a JSON object with a single \"summary\" key.\n\nConstraints:\n1. NO intro text, NO reasoning, NO meta-commentary like \"Task: Summarize...\".\n2. NO markdown code fences for the JSON itself.\n3. DO NOT include any verdict headers like \"\u2705 Approved\" or \"\uD83D\uDCAC Comments posted\".\n4. Format: [File name]: [Concise overview of issues] (lines X-Y).\n5. DO NOT include any priority tags like \"P0\", \"P1\", etc., in the summary text. Mention the impact instead.\n6. If failures occurred, mention: \"\u26A0\uFE0F **[filename]** - automated review could not complete (parse error).\"\n7. Tone: Technical, impact-focused, brief.\n8. Max 200 words. JSON only.";
2
+ declare function buildSummaryPrompt(input: {
3
+ prTitle: string | null;
4
+ verdict: 'approve' | 'comment';
5
+ fileSummaries: Array<{
6
+ path: string;
7
+ summary: string;
8
+ verdict: string;
9
+ }>;
10
+ }): string;
11
+
12
+ export { SUMMARY_SYSTEM_PROMPT, buildSummaryPrompt };
@@ -0,0 +1,50 @@
1
+ // src/prompts/summary.ts
2
+ var SUMMARY_SYSTEM_PROMPT = `You are an automated code review bot. Summarize the findings of a PR review.
3
+ CRITICAL: Return ONLY a JSON object with a single "summary" key.
4
+
5
+ Constraints:
6
+ 1. NO intro text, NO reasoning, NO meta-commentary like "Task: Summarize...".
7
+ 2. NO markdown code fences for the JSON itself.
8
+ 3. DO NOT include any verdict headers like "\u2705 Approved" or "\u{1F4AC} Comments posted".
9
+ 4. Format: [File name]: [Concise overview of issues] (lines X-Y).
10
+ 5. DO NOT include any priority tags like "P0", "P1", etc., in the summary text. Mention the impact instead.
11
+ 6. If failures occurred, mention: "\u26A0\uFE0F **[filename]** - automated review could not complete (parse error)."
12
+ 7. Tone: Technical, impact-focused, brief.
13
+ 8. Max 200 words. JSON only.`;
14
+ function buildSummaryPrompt(input) {
15
+ const successFindings = input.fileSummaries.filter(
16
+ (f) => f.verdict !== "approve" && !f.summary.startsWith("Review failed")
17
+ );
18
+ const approved = input.fileSummaries.filter((f) => f.verdict === "approve");
19
+ const failures = input.fileSummaries.filter((f) => f.summary.startsWith("Review failed"));
20
+ const lines = [
21
+ `PR: "${input.prTitle ?? "Untitled PR"}"`,
22
+ `Verdict: ${input.verdict}`,
23
+ ""
24
+ ];
25
+ if (successFindings.length > 0) {
26
+ lines.push("Files with findings:");
27
+ for (const f of successFindings) {
28
+ lines.push(`- \`${f.path}\` [${f.verdict}]: ${f.summary}`);
29
+ }
30
+ }
31
+ if (approved.length > 0) {
32
+ lines.push(`Files approved with no issues: ${approved.map((f) => `\`${f.path}\``).join(", ")}`);
33
+ }
34
+ if (failures.length > 0) {
35
+ lines.push("Files where automated review failed (mention as warnings):");
36
+ for (const f of failures) {
37
+ const reason = f.summary.replace("Review failed: ", "");
38
+ lines.push(`- \`${f.path}\`: ${reason}`);
39
+ }
40
+ }
41
+ if (successFindings.length === 0 && failures.length === 0) {
42
+ lines.push("No significant findings. All files passed review.");
43
+ }
44
+ return lines.join("\n");
45
+ }
46
+ export {
47
+ SUMMARY_SYSTEM_PROMPT,
48
+ buildSummaryPrompt
49
+ };
50
+ //# sourceMappingURL=summary.js.map