@rigour-labs/core 6.7.6 → 6.7.8

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 (35) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js +1 -0
  3. package/dist/review/backtest-init.d.ts +15 -0
  4. package/dist/review/backtest-init.js +30 -16
  5. package/dist/review/backtest-last.d.ts +40 -0
  6. package/dist/review/backtest-last.js +116 -0
  7. package/dist/review/backtest-last.test.d.ts +1 -0
  8. package/dist/review/backtest-last.test.js +109 -0
  9. package/dist/review/backtest.d.ts +26 -0
  10. package/dist/review/backtest.js +4 -4
  11. package/dist/review/reviewer/adapters.d.ts +11 -4
  12. package/dist/review/reviewer/adapters.js +44 -5
  13. package/dist/review/reviewer/adapters.test.js +16 -1
  14. package/dist/review/reviewer/api-judge.d.ts +28 -0
  15. package/dist/review/reviewer/api-judge.js +161 -0
  16. package/dist/review/reviewer/api-judge.test.d.ts +1 -0
  17. package/dist/review/reviewer/api-judge.test.js +87 -0
  18. package/dist/review/reviewer/context.d.ts +2 -0
  19. package/dist/review/reviewer/context.js +4 -1
  20. package/dist/review/reviewer/settings.d.ts +10 -0
  21. package/dist/review/reviewer/settings.js +3 -1
  22. package/dist/review/reviewer/verdict.js +8 -3
  23. package/dist/review/reviewer.d.ts +2 -0
  24. package/dist/review/reviewer.js +17 -5
  25. package/dist/review/reviewer.test.js +35 -3
  26. package/dist/review-learning/lessons.d.ts +2 -0
  27. package/dist/review-learning/lessons.js +17 -1
  28. package/dist/review-learning/repo-rules.test.js +3 -0
  29. package/dist/review-learning/review-learning.test.js +9 -0
  30. package/dist/review-learning/team-lessons.d.ts +2 -2
  31. package/dist/review-learning/team-lessons.js +3 -3
  32. package/dist/templates/universal-config.js +1 -0
  33. package/dist/types/index.d.ts +74 -0
  34. package/dist/types/index.js +14 -0
  35. package/package.json +6 -6
@@ -13,14 +13,14 @@ export function activeLessons(cwd, mode = DEFAULT_LESSON_MODE) {
13
13
  return [];
14
14
  return readLessons(cwd).filter(l => mode === 'all' || l.state === 'verified');
15
15
  }
16
- /** `standards`: how many team standards may come with the file lessons (a judge reading a whole pull request takes more than an agent's one question). */
17
- export function lessonsForDiff(cwd, diff, mode = DEFAULT_LESSON_MODE, standards) {
16
+ /** `standards`, `limit`, `perFile`: how many team standards and file lessons may come, and how many per file (a judge reading a whole pull request takes more than an agent's one question). */
17
+ export function lessonsForDiff(cwd, diff, mode = DEFAULT_LESSON_MODE, standards, limit, perFile, excludePr) {
18
18
  if (mode === 'off')
19
19
  return [];
20
20
  const lessons = readLessons(cwd);
21
21
  if (lessons.length === 0)
22
22
  return [];
23
- return matchLessons(lessons, changeShape(diff), { includeCandidates: mode === 'all', ...(standards !== undefined ? { standards } : {}) });
23
+ return matchLessons(lessons, changeShape(diff), { includeCandidates: mode === 'all', ...(standards !== undefined ? { standards } : {}), ...(limit !== undefined ? { limit } : {}), ...(perFile !== undefined ? { perFile } : {}), ...(excludePr !== undefined ? { excludePr } : {}) });
24
24
  }
25
25
  /** The points this team rejected that a change touches: what the judges are told is settled. */
26
26
  export function rejectedForDiff(cwd, diff) {
@@ -293,6 +293,7 @@ export const UNIVERSAL_CONFIG = {
293
293
  escalate: 'always',
294
294
  cross_models: {},
295
295
  judge_env: {},
296
+ reasoning: {},
296
297
  },
297
298
  },
298
299
  ignore: [],
@@ -2457,6 +2457,32 @@ export declare const ConfigSchema: z.ZodObject<{
2457
2457
  escalate: z.ZodDefault<z.ZodOptional<z.ZodEnum<["always", "risk"]>>>;
2458
2458
  /** A model per reviewer name for cross-examination (a narrow verification task), e.g. { claude: "haiku" }. */
2459
2459
  cross_models: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
2460
+ /** Reasoning effort per reviewer name where the CLI or API takes one (codex, api): low, medium or high. */
2461
+ reasoning: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<["low", "medium", "high"]>>>>;
2462
+ /**
2463
+ * A judge reached through a model API (OpenAI-compatible chat completions with tools), named `api` in
2464
+ * `reviewers`: any model the team can call. The key is read from the environment variable `key_env`, never
2465
+ * from this file. `vendor` is the model's maker, for cross and full modes (inferred from the model name when unset).
2466
+ */
2467
+ api: z.ZodOptional<z.ZodObject<{
2468
+ url: z.ZodString;
2469
+ model: z.ZodString;
2470
+ key_env: z.ZodDefault<z.ZodOptional<z.ZodString>>;
2471
+ vendor: z.ZodOptional<z.ZodEnum<["anthropic", "openai", "google", "other"]>>;
2472
+ max_turns: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
2473
+ }, "strip", z.ZodTypeAny, {
2474
+ model: string;
2475
+ url: string;
2476
+ key_env: string;
2477
+ max_turns: number;
2478
+ vendor?: "anthropic" | "openai" | "google" | "other" | undefined;
2479
+ }, {
2480
+ model: string;
2481
+ url: string;
2482
+ key_env?: string | undefined;
2483
+ vendor?: "anthropic" | "openai" | "google" | "other" | undefined;
2484
+ max_turns?: number | undefined;
2485
+ }>>;
2460
2486
  /**
2461
2487
  * Environment variables a judge's CLI must not see, per reviewer name, e.g. { codex: { unset: [OPENAI_API_KEY] } }
2462
2488
  * when that variable holds a key meant for another service. RIGOUR_API_KEY is never passed to a judge.
@@ -2482,12 +2508,20 @@ export declare const ConfigSchema: z.ZodObject<{
2482
2508
  judges: 2 | 3;
2483
2509
  escalate: "always" | "risk";
2484
2510
  cross_models: Record<string, string>;
2511
+ reasoning: Record<string, "high" | "medium" | "low">;
2485
2512
  judge_env: Record<string, {
2486
2513
  unset: string[];
2487
2514
  }>;
2488
2515
  model?: string | undefined;
2489
2516
  max_runs_per_day?: number | undefined;
2490
2517
  max_usd_per_day?: number | undefined;
2518
+ api?: {
2519
+ model: string;
2520
+ url: string;
2521
+ key_env: string;
2522
+ max_turns: number;
2523
+ vendor?: "anthropic" | "openai" | "google" | "other" | undefined;
2524
+ } | undefined;
2491
2525
  }, {
2492
2526
  enabled?: boolean | undefined;
2493
2527
  mode?: "single" | "cross" | "full" | undefined;
@@ -2505,6 +2539,14 @@ export declare const ConfigSchema: z.ZodObject<{
2505
2539
  judges?: 2 | 3 | undefined;
2506
2540
  escalate?: "always" | "risk" | undefined;
2507
2541
  cross_models?: Record<string, string> | undefined;
2542
+ reasoning?: Record<string, "high" | "medium" | "low"> | undefined;
2543
+ api?: {
2544
+ model: string;
2545
+ url: string;
2546
+ key_env?: string | undefined;
2547
+ vendor?: "anthropic" | "openai" | "google" | "other" | undefined;
2548
+ max_turns?: number | undefined;
2549
+ } | undefined;
2508
2550
  judge_env?: Record<string, {
2509
2551
  unset?: string[] | undefined;
2510
2552
  }> | undefined;
@@ -2526,12 +2568,20 @@ export declare const ConfigSchema: z.ZodObject<{
2526
2568
  judges: 2 | 3;
2527
2569
  escalate: "always" | "risk";
2528
2570
  cross_models: Record<string, string>;
2571
+ reasoning: Record<string, "high" | "medium" | "low">;
2529
2572
  judge_env: Record<string, {
2530
2573
  unset: string[];
2531
2574
  }>;
2532
2575
  model?: string | undefined;
2533
2576
  max_runs_per_day?: number | undefined;
2534
2577
  max_usd_per_day?: number | undefined;
2578
+ api?: {
2579
+ model: string;
2580
+ url: string;
2581
+ key_env: string;
2582
+ max_turns: number;
2583
+ vendor?: "anthropic" | "openai" | "google" | "other" | undefined;
2584
+ } | undefined;
2535
2585
  };
2536
2586
  github_account?: string | undefined;
2537
2587
  }, {
@@ -2555,6 +2605,14 @@ export declare const ConfigSchema: z.ZodObject<{
2555
2605
  judges?: 2 | 3 | undefined;
2556
2606
  escalate?: "always" | "risk" | undefined;
2557
2607
  cross_models?: Record<string, string> | undefined;
2608
+ reasoning?: Record<string, "high" | "medium" | "low"> | undefined;
2609
+ api?: {
2610
+ model: string;
2611
+ url: string;
2612
+ key_env?: string | undefined;
2613
+ vendor?: "anthropic" | "openai" | "google" | "other" | undefined;
2614
+ max_turns?: number | undefined;
2615
+ } | undefined;
2558
2616
  judge_env?: Record<string, {
2559
2617
  unset?: string[] | undefined;
2560
2618
  }> | undefined;
@@ -2832,12 +2890,20 @@ export declare const ConfigSchema: z.ZodObject<{
2832
2890
  judges: 2 | 3;
2833
2891
  escalate: "always" | "risk";
2834
2892
  cross_models: Record<string, string>;
2893
+ reasoning: Record<string, "high" | "medium" | "low">;
2835
2894
  judge_env: Record<string, {
2836
2895
  unset: string[];
2837
2896
  }>;
2838
2897
  model?: string | undefined;
2839
2898
  max_runs_per_day?: number | undefined;
2840
2899
  max_usd_per_day?: number | undefined;
2900
+ api?: {
2901
+ model: string;
2902
+ url: string;
2903
+ key_env: string;
2904
+ max_turns: number;
2905
+ vendor?: "anthropic" | "openai" | "google" | "other" | undefined;
2906
+ } | undefined;
2841
2907
  };
2842
2908
  github_account?: string | undefined;
2843
2909
  };
@@ -3120,6 +3186,14 @@ export declare const ConfigSchema: z.ZodObject<{
3120
3186
  judges?: 2 | 3 | undefined;
3121
3187
  escalate?: "always" | "risk" | undefined;
3122
3188
  cross_models?: Record<string, string> | undefined;
3189
+ reasoning?: Record<string, "high" | "medium" | "low"> | undefined;
3190
+ api?: {
3191
+ model: string;
3192
+ url: string;
3193
+ key_env?: string | undefined;
3194
+ vendor?: "anthropic" | "openai" | "google" | "other" | undefined;
3195
+ max_turns?: number | undefined;
3196
+ } | undefined;
3123
3197
  judge_env?: Record<string, {
3124
3198
  unset?: string[] | undefined;
3125
3199
  }> | undefined;
@@ -423,6 +423,20 @@ export const ConfigSchema = z.object({
423
423
  escalate: z.enum(['always', 'risk']).optional().default('always'),
424
424
  /** A model per reviewer name for cross-examination (a narrow verification task), e.g. { claude: "haiku" }. */
425
425
  cross_models: z.record(ModelName).optional().default({}),
426
+ /** Reasoning effort per reviewer name where the CLI or API takes one (codex, api): low, medium or high. */
427
+ reasoning: z.record(z.enum(['low', 'medium', 'high'])).optional().default({}),
428
+ /**
429
+ * A judge reached through a model API (OpenAI-compatible chat completions with tools), named `api` in
430
+ * `reviewers`: any model the team can call. The key is read from the environment variable `key_env`, never
431
+ * from this file. `vendor` is the model's maker, for cross and full modes (inferred from the model name when unset).
432
+ */
433
+ api: z.object({
434
+ url: z.string().url(),
435
+ model: z.string().min(1),
436
+ key_env: z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, 'an environment variable name').optional().default('RIGOUR_JUDGE_API_KEY'),
437
+ vendor: z.enum(['anthropic', 'openai', 'google', 'other']).optional(),
438
+ max_turns: z.number().int().positive().optional().default(60),
439
+ }).optional(),
426
440
  /**
427
441
  * Environment variables a judge's CLI must not see, per reviewer name, e.g. { codex: { unset: [OPENAI_API_KEY] } }
428
442
  * when that variable holds a key meant for another service. RIGOUR_API_KEY is never passed to a judge.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rigour-labs/core",
3
- "version": "6.7.6",
3
+ "version": "6.7.8",
4
4
  "description": "Rigour's review engine: deterministic gates on changed lines, rules and lessons learned from your team's fixes, and per-check precision from what you fix versus dismiss, across TypeScript, JavaScript, Python, Go, Ruby and C#.",
5
5
  "engines": {
6
6
  "node": ">=22.13"
@@ -72,11 +72,11 @@
72
72
  "@anthropic-ai/sdk": "^0.30.1",
73
73
  "pg": "^8.16.3",
74
74
  "openai": "^5.23.2",
75
- "@rigour-labs/brain-darwin-arm64": "6.7.6",
76
- "@rigour-labs/brain-darwin-x64": "6.7.6",
77
- "@rigour-labs/brain-linux-arm64": "6.7.6",
78
- "@rigour-labs/brain-linux-x64": "6.7.6",
79
- "@rigour-labs/brain-win-x64": "6.7.6"
75
+ "@rigour-labs/brain-darwin-arm64": "6.7.8",
76
+ "@rigour-labs/brain-darwin-x64": "6.7.8",
77
+ "@rigour-labs/brain-linux-x64": "6.7.8",
78
+ "@rigour-labs/brain-linux-arm64": "6.7.8",
79
+ "@rigour-labs/brain-win-x64": "6.7.8"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@types/fs-extra": "^11.0.4",