@simonren/quorum 0.9.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +91 -48
  2. package/commands/multi-consult.md +47 -72
  3. package/commands/multi-review.md +68 -99
  4. package/dist/adapters/base.d.ts +53 -70
  5. package/dist/adapters/base.js +21 -79
  6. package/dist/adapters/claude.d.ts +38 -17
  7. package/dist/adapters/claude.js +93 -185
  8. package/dist/adapters/cli-adapter.d.ts +78 -0
  9. package/dist/adapters/cli-adapter.js +217 -0
  10. package/dist/adapters/codex.d.ts +18 -13
  11. package/dist/adapters/codex.js +64 -200
  12. package/dist/adapters/gemini.d.ts +30 -21
  13. package/dist/adapters/gemini.js +55 -149
  14. package/dist/adapters/index.d.ts +8 -5
  15. package/dist/adapters/index.js +7 -8
  16. package/dist/config.d.ts +98 -28
  17. package/dist/config.js +44 -25
  18. package/dist/consult-prompt.d.ts +6 -5
  19. package/dist/consult-prompt.js +48 -23
  20. package/dist/decoders/claude.d.ts +6 -0
  21. package/dist/decoders/claude.js +10 -1
  22. package/dist/doctor.d.ts +20 -0
  23. package/dist/doctor.js +91 -0
  24. package/dist/executor.d.ts +58 -46
  25. package/dist/executor.js +218 -129
  26. package/dist/guards.d.ts +29 -0
  27. package/dist/guards.js +72 -0
  28. package/dist/handoff.d.ts +79 -229
  29. package/dist/handoff.js +411 -402
  30. package/dist/index.d.ts +8 -12
  31. package/dist/index.js +81 -106
  32. package/dist/integrity.d.ts +16 -0
  33. package/dist/integrity.js +49 -0
  34. package/dist/sections.d.ts +22 -0
  35. package/dist/sections.js +31 -0
  36. package/dist/server.d.ts +9 -0
  37. package/dist/server.js +36 -0
  38. package/dist/tools/consult.d.ts +17 -76
  39. package/dist/tools/consult.js +72 -188
  40. package/dist/tools/format.d.ts +35 -0
  41. package/dist/tools/format.js +85 -0
  42. package/dist/tools/review.d.ts +55 -0
  43. package/dist/tools/review.js +120 -0
  44. package/dist/types.d.ts +20 -103
  45. package/dist/types.js +18 -29
  46. package/package.json +7 -4
  47. package/dist/cli/check.d.ts +0 -20
  48. package/dist/cli/check.js +0 -78
  49. package/dist/cli/codex.d.ts +0 -11
  50. package/dist/cli/codex.js +0 -255
  51. package/dist/cli/gemini.d.ts +0 -12
  52. package/dist/cli/gemini.js +0 -253
  53. package/dist/context.d.ts +0 -1538
  54. package/dist/context.js +0 -383
  55. package/dist/decoders/gemini.d.ts +0 -33
  56. package/dist/decoders/gemini.js +0 -58
  57. package/dist/errors.d.ts +0 -46
  58. package/dist/errors.js +0 -198
  59. package/dist/pipeline.d.ts +0 -135
  60. package/dist/pipeline.js +0 -462
  61. package/dist/prompt-v2.d.ts +0 -38
  62. package/dist/prompt-v2.js +0 -391
  63. package/dist/prompt.d.ts +0 -71
  64. package/dist/prompt.js +0 -309
  65. package/dist/schema.d.ts +0 -660
  66. package/dist/schema.js +0 -536
  67. package/dist/tools/feedback.d.ts +0 -91
  68. package/dist/tools/feedback.js +0 -117
@@ -1,12 +1,15 @@
1
1
  /**
2
- * Adapter Registry
2
+ * Adapter registry entry point.
3
3
  *
4
- * Exports all registered adapters and utility functions.
4
+ * Importing this module registers every built-in adapter. To add a CLI:
5
+ * subclass `CliAdapter`, register the instance, and import the module here.
5
6
  */
6
7
  import './codex.js';
7
8
  import './gemini.js';
8
9
  import './claude.js';
9
10
  export * from './base.js';
10
- export { codexAdapter } from './codex.js';
11
- export { geminiAdapter } from './gemini.js';
12
- export { claudeAdapter } from './claude.js';
11
+ export { CliAdapter, AVAILABILITY_TTL_MS, probeVersion } from './cli-adapter.js';
12
+ export type { CliOutcome, RunContext, RunLimits } from './cli-adapter.js';
13
+ export { codexAdapter, CodexAdapter } from './codex.js';
14
+ export { geminiAdapter, GeminiAdapter } from './gemini.js';
15
+ export { claudeAdapter, ClaudeAdapter } from './claude.js';
@@ -1,15 +1,14 @@
1
1
  /**
2
- * Adapter Registry
2
+ * Adapter registry entry point.
3
3
  *
4
- * Exports all registered adapters and utility functions.
4
+ * Importing this module registers every built-in adapter. To add a CLI:
5
+ * subclass `CliAdapter`, register the instance, and import the module here.
5
6
  */
6
- // Import adapters to register them
7
7
  import './codex.js';
8
8
  import './gemini.js';
9
9
  import './claude.js';
10
- // Re-export everything from base
11
10
  export * from './base.js';
12
- // Export specific adapters
13
- export { codexAdapter } from './codex.js';
14
- export { geminiAdapter } from './gemini.js';
15
- export { claudeAdapter } from './claude.js';
11
+ export { CliAdapter, AVAILABILITY_TTL_MS, probeVersion } from './cli-adapter.js';
12
+ export { codexAdapter, CodexAdapter } from './codex.js';
13
+ export { geminiAdapter, GeminiAdapter } from './gemini.js';
14
+ export { claudeAdapter, ClaudeAdapter } from './claude.js';
package/dist/config.d.ts CHANGED
@@ -4,22 +4,26 @@
4
4
  * Config file: ~/.config/quorum/config.json
5
5
  *
6
6
  * Semantics:
7
- * - Lazy, cached load. `getConfig()` returns the cached config or reads once.
8
- * - Missing file → defaults in memory (no write). Use `initConfig()` from the
9
- * server entry point to create the file with defaults on first launch.
10
- * - Invalid JSON or schema violations → fall back to defaults, warn on stderr.
7
+ * - Lazy, cached load with mtime-based hot reload. `getConfig()` returns the
8
+ * cached config or re-reads when the file changed on disk.
9
+ * - Missing file → defaults in memory (no write). `initConfig()` (server
10
+ * start-up) creates the file with defaults on first launch.
11
+ * - Invalid JSON → defaults, warn on stderr. A schema violation in one
12
+ * adapter's section resets only that section; the others survive.
11
13
  * - Partial user configs are deep-merged against defaults via Zod `.default()`.
12
- * - Tool-call arguments still override config (e.g. `reasoningEffort` on a
13
- * single `codex_review` call). Config only sets defaults.
14
+ * - Tool-call arguments override config (e.g. `reasoningEffort` on a single
15
+ * `multi_review` call). Config only sets defaults.
14
16
  */
15
17
  import { z } from 'zod';
16
18
  export declare const CodexConfigSchema: z.ZodDefault<z.ZodObject<{
19
+ /** Set to false to leave Codex out of the panel even when installed. */
20
+ enabled: z.ZodDefault<z.ZodBoolean>;
17
21
  model: z.ZodDefault<z.ZodString>;
18
22
  reasoningEffort: z.ZodDefault<z.ZodEnum<["high", "xhigh"]>>;
19
23
  serviceTier: z.ZodDefault<z.ZodEnum<["default", "fast", "flex"]>>;
20
- /** Consult-specific defaults — separate from review knobs because consult
21
- * questions are deeper and warrant more reasoning. Users can override
22
- * these to cap cost without affecting review behavior. */
24
+ /** Consult-specific defaults — consult questions are deeper than reviews,
25
+ * so the default leans toward more reasoning. Override to cap cost without
26
+ * touching review behaviour. */
23
27
  consultReasoningEffort: z.ZodDefault<z.ZodEnum<["high", "xhigh"]>>;
24
28
  consultServiceTier: z.ZodDefault<z.ZodEnum<["default", "fast", "flex"]>>;
25
29
  /**
@@ -27,10 +31,10 @@ export declare const CodexConfigSchema: z.ZodDefault<z.ZodObject<{
27
31
  *
28
32
  * Normally the rollout-file liveness watcher (`codex-liveness.ts`) resets
29
33
  * this timer while the model reasons, so it only fires on a genuinely dead
30
- * process. These values are what protects a run when that watcher cannot
31
- * find the rollout file (`--ephemeral`, a relocated CODEX_HOME, a layout
32
- * change), and they must therefore exceed a realistic reasoning block:
33
- * an xhigh block has been measured at 287s of unbroken silence.
34
+ * process. These values protect a run when that watcher cannot find the
35
+ * rollout file (`--ephemeral`, a relocated CODEX_HOME, a layout change),
36
+ * and must therefore exceed a realistic reasoning block: an xhigh block
37
+ * has been measured at 287s of unbroken silence.
34
38
  */
35
39
  inactivityTimeoutMs: z.ZodDefault<z.ZodObject<{
36
40
  high: z.ZodDefault<z.ZodNumber>;
@@ -45,6 +49,7 @@ export declare const CodexConfigSchema: z.ZodDefault<z.ZodObject<{
45
49
  maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
46
50
  maxBufferSize: z.ZodDefault<z.ZodNumber>;
47
51
  }, "strip", z.ZodTypeAny, {
52
+ enabled: boolean;
48
53
  model: string;
49
54
  reasoningEffort: "high" | "xhigh";
50
55
  serviceTier: "default" | "fast" | "flex";
@@ -57,6 +62,7 @@ export declare const CodexConfigSchema: z.ZodDefault<z.ZodObject<{
57
62
  maxTimeoutMs: number;
58
63
  maxBufferSize: number;
59
64
  }, {
65
+ enabled?: boolean | undefined;
60
66
  model?: string | undefined;
61
67
  reasoningEffort?: "high" | "xhigh" | undefined;
62
68
  serviceTier?: "default" | "fast" | "flex" | undefined;
@@ -70,22 +76,45 @@ export declare const CodexConfigSchema: z.ZodDefault<z.ZodObject<{
70
76
  maxBufferSize?: number | undefined;
71
77
  }>>;
72
78
  export declare const ClaudeConfigSchema: z.ZodDefault<z.ZodObject<{
79
+ /** Set to false to leave the fresh-context Claude reviewer out of the panel. */
80
+ enabled: z.ZodDefault<z.ZodBoolean>;
81
+ /** `claude --model`: an alias (`fable`, `opus`, `sonnet`) or a full model id. */
73
82
  model: z.ZodDefault<z.ZodString>;
83
+ /**
84
+ * `claude --fallback-model`: used when `model` is overloaded or the account
85
+ * cannot reach it. Set to null to run without a fallback.
86
+ */
87
+ fallbackModel: z.ZodDefault<z.ZodNullable<z.ZodString>>;
88
+ /** `claude --effort` for review passes. null omits the flag (older CLIs). */
89
+ effort: z.ZodDefault<z.ZodNullable<z.ZodEnum<["low", "medium", "high", "xhigh", "max"]>>>;
90
+ /** `claude --effort` for consult. null omits the flag. */
91
+ consultEffort: z.ZodDefault<z.ZodNullable<z.ZodEnum<["low", "medium", "high", "xhigh", "max"]>>>;
92
+ /** Claude streams an event per tool call, so silence really does mean stuck. */
74
93
  inactivityTimeoutMs: z.ZodDefault<z.ZodNumber>;
75
94
  maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
76
95
  maxBufferSize: z.ZodDefault<z.ZodNumber>;
77
96
  }, "strip", z.ZodTypeAny, {
97
+ enabled: boolean;
78
98
  model: string;
79
99
  inactivityTimeoutMs: number;
80
100
  maxTimeoutMs: number;
81
101
  maxBufferSize: number;
102
+ fallbackModel: string | null;
103
+ effort: "high" | "xhigh" | "low" | "medium" | "max" | null;
104
+ consultEffort: "high" | "xhigh" | "low" | "medium" | "max" | null;
82
105
  }, {
106
+ enabled?: boolean | undefined;
83
107
  model?: string | undefined;
84
108
  inactivityTimeoutMs?: number | undefined;
85
109
  maxTimeoutMs?: number | undefined;
86
110
  maxBufferSize?: number | undefined;
111
+ fallbackModel?: string | null | undefined;
112
+ effort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
113
+ consultEffort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
87
114
  }>>;
88
115
  export declare const GeminiConfigSchema: z.ZodDefault<z.ZodObject<{
116
+ /** Set to false to leave Gemini out of the panel even when agy is installed. */
117
+ enabled: z.ZodDefault<z.ZodBoolean>;
89
118
  /**
90
119
  * Passed through as `agy --model`. Optional: when unset the adapter omits
91
120
  * the flag and agy picks the model from its own settings. Run `agy models`
@@ -96,18 +125,19 @@ export declare const GeminiConfigSchema: z.ZodDefault<z.ZodObject<{
96
125
  * `agy --print` emits nothing until it is done, so there is no activity to
97
126
  * reset this timer and no way to tell a working run from a wedged one —
98
127
  * it is effectively a total-runtime cap, and anything under a realistic
99
- * review duration just kills healthy runs. Same failure mode as Codex's
100
- * silent reasoning blocks, minus any out-of-band liveness signal to watch.
128
+ * review duration just kills healthy runs.
101
129
  */
102
130
  inactivityTimeoutMs: z.ZodDefault<z.ZodNumber>;
103
131
  maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
104
132
  maxBufferSize: z.ZodDefault<z.ZodNumber>;
105
133
  }, "strip", z.ZodTypeAny, {
134
+ enabled: boolean;
106
135
  inactivityTimeoutMs: number;
107
136
  maxTimeoutMs: number;
108
137
  maxBufferSize: number;
109
138
  model?: string | undefined;
110
139
  }, {
140
+ enabled?: boolean | undefined;
111
141
  model?: string | undefined;
112
142
  inactivityTimeoutMs?: number | undefined;
113
143
  maxTimeoutMs?: number | undefined;
@@ -115,12 +145,14 @@ export declare const GeminiConfigSchema: z.ZodDefault<z.ZodObject<{
115
145
  }>>;
116
146
  export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
117
147
  codex: z.ZodDefault<z.ZodObject<{
148
+ /** Set to false to leave Codex out of the panel even when installed. */
149
+ enabled: z.ZodDefault<z.ZodBoolean>;
118
150
  model: z.ZodDefault<z.ZodString>;
119
151
  reasoningEffort: z.ZodDefault<z.ZodEnum<["high", "xhigh"]>>;
120
152
  serviceTier: z.ZodDefault<z.ZodEnum<["default", "fast", "flex"]>>;
121
- /** Consult-specific defaults — separate from review knobs because consult
122
- * questions are deeper and warrant more reasoning. Users can override
123
- * these to cap cost without affecting review behavior. */
153
+ /** Consult-specific defaults — consult questions are deeper than reviews,
154
+ * so the default leans toward more reasoning. Override to cap cost without
155
+ * touching review behaviour. */
124
156
  consultReasoningEffort: z.ZodDefault<z.ZodEnum<["high", "xhigh"]>>;
125
157
  consultServiceTier: z.ZodDefault<z.ZodEnum<["default", "fast", "flex"]>>;
126
158
  /**
@@ -128,10 +160,10 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
128
160
  *
129
161
  * Normally the rollout-file liveness watcher (`codex-liveness.ts`) resets
130
162
  * this timer while the model reasons, so it only fires on a genuinely dead
131
- * process. These values are what protects a run when that watcher cannot
132
- * find the rollout file (`--ephemeral`, a relocated CODEX_HOME, a layout
133
- * change), and they must therefore exceed a realistic reasoning block:
134
- * an xhigh block has been measured at 287s of unbroken silence.
163
+ * process. These values protect a run when that watcher cannot find the
164
+ * rollout file (`--ephemeral`, a relocated CODEX_HOME, a layout change),
165
+ * and must therefore exceed a realistic reasoning block: an xhigh block
166
+ * has been measured at 287s of unbroken silence.
135
167
  */
136
168
  inactivityTimeoutMs: z.ZodDefault<z.ZodObject<{
137
169
  high: z.ZodDefault<z.ZodNumber>;
@@ -146,6 +178,7 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
146
178
  maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
147
179
  maxBufferSize: z.ZodDefault<z.ZodNumber>;
148
180
  }, "strip", z.ZodTypeAny, {
181
+ enabled: boolean;
149
182
  model: string;
150
183
  reasoningEffort: "high" | "xhigh";
151
184
  serviceTier: "default" | "fast" | "flex";
@@ -158,6 +191,7 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
158
191
  maxTimeoutMs: number;
159
192
  maxBufferSize: number;
160
193
  }, {
194
+ enabled?: boolean | undefined;
161
195
  model?: string | undefined;
162
196
  reasoningEffort?: "high" | "xhigh" | undefined;
163
197
  serviceTier?: "default" | "fast" | "flex" | undefined;
@@ -171,22 +205,45 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
171
205
  maxBufferSize?: number | undefined;
172
206
  }>>;
173
207
  claude: z.ZodDefault<z.ZodObject<{
208
+ /** Set to false to leave the fresh-context Claude reviewer out of the panel. */
209
+ enabled: z.ZodDefault<z.ZodBoolean>;
210
+ /** `claude --model`: an alias (`fable`, `opus`, `sonnet`) or a full model id. */
174
211
  model: z.ZodDefault<z.ZodString>;
212
+ /**
213
+ * `claude --fallback-model`: used when `model` is overloaded or the account
214
+ * cannot reach it. Set to null to run without a fallback.
215
+ */
216
+ fallbackModel: z.ZodDefault<z.ZodNullable<z.ZodString>>;
217
+ /** `claude --effort` for review passes. null omits the flag (older CLIs). */
218
+ effort: z.ZodDefault<z.ZodNullable<z.ZodEnum<["low", "medium", "high", "xhigh", "max"]>>>;
219
+ /** `claude --effort` for consult. null omits the flag. */
220
+ consultEffort: z.ZodDefault<z.ZodNullable<z.ZodEnum<["low", "medium", "high", "xhigh", "max"]>>>;
221
+ /** Claude streams an event per tool call, so silence really does mean stuck. */
175
222
  inactivityTimeoutMs: z.ZodDefault<z.ZodNumber>;
176
223
  maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
177
224
  maxBufferSize: z.ZodDefault<z.ZodNumber>;
178
225
  }, "strip", z.ZodTypeAny, {
226
+ enabled: boolean;
179
227
  model: string;
180
228
  inactivityTimeoutMs: number;
181
229
  maxTimeoutMs: number;
182
230
  maxBufferSize: number;
231
+ fallbackModel: string | null;
232
+ effort: "high" | "xhigh" | "low" | "medium" | "max" | null;
233
+ consultEffort: "high" | "xhigh" | "low" | "medium" | "max" | null;
183
234
  }, {
235
+ enabled?: boolean | undefined;
184
236
  model?: string | undefined;
185
237
  inactivityTimeoutMs?: number | undefined;
186
238
  maxTimeoutMs?: number | undefined;
187
239
  maxBufferSize?: number | undefined;
240
+ fallbackModel?: string | null | undefined;
241
+ effort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
242
+ consultEffort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
188
243
  }>>;
189
244
  gemini: z.ZodDefault<z.ZodObject<{
245
+ /** Set to false to leave Gemini out of the panel even when agy is installed. */
246
+ enabled: z.ZodDefault<z.ZodBoolean>;
190
247
  /**
191
248
  * Passed through as `agy --model`. Optional: when unset the adapter omits
192
249
  * the flag and agy picks the model from its own settings. Run `agy models`
@@ -197,18 +254,19 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
197
254
  * `agy --print` emits nothing until it is done, so there is no activity to
198
255
  * reset this timer and no way to tell a working run from a wedged one —
199
256
  * it is effectively a total-runtime cap, and anything under a realistic
200
- * review duration just kills healthy runs. Same failure mode as Codex's
201
- * silent reasoning blocks, minus any out-of-band liveness signal to watch.
257
+ * review duration just kills healthy runs.
202
258
  */
203
259
  inactivityTimeoutMs: z.ZodDefault<z.ZodNumber>;
204
260
  maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
205
261
  maxBufferSize: z.ZodDefault<z.ZodNumber>;
206
262
  }, "strip", z.ZodTypeAny, {
263
+ enabled: boolean;
207
264
  inactivityTimeoutMs: number;
208
265
  maxTimeoutMs: number;
209
266
  maxBufferSize: number;
210
267
  model?: string | undefined;
211
268
  }, {
269
+ enabled?: boolean | undefined;
212
270
  model?: string | undefined;
213
271
  inactivityTimeoutMs?: number | undefined;
214
272
  maxTimeoutMs?: number | undefined;
@@ -216,6 +274,7 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
216
274
  }>>;
217
275
  }, "strip", z.ZodTypeAny, {
218
276
  codex: {
277
+ enabled: boolean;
219
278
  model: string;
220
279
  reasoningEffort: "high" | "xhigh";
221
280
  serviceTier: "default" | "fast" | "flex";
@@ -229,12 +288,17 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
229
288
  maxBufferSize: number;
230
289
  };
231
290
  claude: {
291
+ enabled: boolean;
232
292
  model: string;
233
293
  inactivityTimeoutMs: number;
234
294
  maxTimeoutMs: number;
235
295
  maxBufferSize: number;
296
+ fallbackModel: string | null;
297
+ effort: "high" | "xhigh" | "low" | "medium" | "max" | null;
298
+ consultEffort: "high" | "xhigh" | "low" | "medium" | "max" | null;
236
299
  };
237
300
  gemini: {
301
+ enabled: boolean;
238
302
  inactivityTimeoutMs: number;
239
303
  maxTimeoutMs: number;
240
304
  maxBufferSize: number;
@@ -242,6 +306,7 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
242
306
  };
243
307
  }, {
244
308
  codex?: {
309
+ enabled?: boolean | undefined;
245
310
  model?: string | undefined;
246
311
  reasoningEffort?: "high" | "xhigh" | undefined;
247
312
  serviceTier?: "default" | "fast" | "flex" | undefined;
@@ -255,12 +320,17 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
255
320
  maxBufferSize?: number | undefined;
256
321
  } | undefined;
257
322
  claude?: {
323
+ enabled?: boolean | undefined;
258
324
  model?: string | undefined;
259
325
  inactivityTimeoutMs?: number | undefined;
260
326
  maxTimeoutMs?: number | undefined;
261
327
  maxBufferSize?: number | undefined;
328
+ fallbackModel?: string | null | undefined;
329
+ effort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
330
+ consultEffort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
262
331
  } | undefined;
263
332
  gemini?: {
333
+ enabled?: boolean | undefined;
264
334
  model?: string | undefined;
265
335
  inactivityTimeoutMs?: number | undefined;
266
336
  maxTimeoutMs?: number | undefined;
@@ -275,10 +345,10 @@ export declare const DEFAULT_CONFIG: Config;
275
345
  export declare function getConfigPath(): string;
276
346
  export declare function getConfig(): Config;
277
347
  /**
278
- * Create the config file with defaults if it does not exist.
279
- * Uses the exclusive `wx` flag for atomic creation — safe against TOCTOU races
280
- * when multiple server instances start concurrently.
281
- * Refreshes the cached config so subsequent `getConfig()` calls see disk state.
348
+ * Create the config file with defaults if it does not exist. Uses the
349
+ * exclusive `wx` flag for atomic creation — safe against TOCTOU races when
350
+ * multiple server instances start concurrently. Refreshes the cache so
351
+ * subsequent `getConfig()` calls see disk state.
282
352
  */
283
353
  export declare function initConfig(): {
284
354
  path: string;
package/dist/config.js CHANGED
@@ -4,40 +4,45 @@
4
4
  * Config file: ~/.config/quorum/config.json
5
5
  *
6
6
  * Semantics:
7
- * - Lazy, cached load. `getConfig()` returns the cached config or reads once.
8
- * - Missing file → defaults in memory (no write). Use `initConfig()` from the
9
- * server entry point to create the file with defaults on first launch.
10
- * - Invalid JSON or schema violations → fall back to defaults, warn on stderr.
7
+ * - Lazy, cached load with mtime-based hot reload. `getConfig()` returns the
8
+ * cached config or re-reads when the file changed on disk.
9
+ * - Missing file → defaults in memory (no write). `initConfig()` (server
10
+ * start-up) creates the file with defaults on first launch.
11
+ * - Invalid JSON → defaults, warn on stderr. A schema violation in one
12
+ * adapter's section resets only that section; the others survive.
11
13
  * - Partial user configs are deep-merged against defaults via Zod `.default()`.
12
- * - Tool-call arguments still override config (e.g. `reasoningEffort` on a
13
- * single `codex_review` call). Config only sets defaults.
14
+ * - Tool-call arguments override config (e.g. `reasoningEffort` on a single
15
+ * `multi_review` call). Config only sets defaults.
14
16
  */
15
17
  import { z } from 'zod';
16
18
  import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'fs';
17
19
  import { dirname, join } from 'path';
18
20
  import { homedir } from 'os';
21
+ import { CLAUDE_EFFORTS, REASONING_EFFORTS, SERVICE_TIERS } from './types.js';
19
22
  // =============================================================================
20
23
  // SCHEMA
21
24
  // =============================================================================
22
25
  export const CodexConfigSchema = z
23
26
  .object({
27
+ /** Set to false to leave Codex out of the panel even when installed. */
28
+ enabled: z.boolean().default(true),
24
29
  model: z.string().default('gpt-5.5'),
25
- reasoningEffort: z.enum(['high', 'xhigh']).default('high'),
26
- serviceTier: z.enum(['default', 'fast', 'flex']).default('fast'),
27
- /** Consult-specific defaults — separate from review knobs because consult
28
- * questions are deeper and warrant more reasoning. Users can override
29
- * these to cap cost without affecting review behavior. */
30
- consultReasoningEffort: z.enum(['high', 'xhigh']).default('xhigh'),
31
- consultServiceTier: z.enum(['default', 'fast', 'flex']).default('fast'),
30
+ reasoningEffort: z.enum(REASONING_EFFORTS).default('high'),
31
+ serviceTier: z.enum(SERVICE_TIERS).default('fast'),
32
+ /** Consult-specific defaults — consult questions are deeper than reviews,
33
+ * so the default leans toward more reasoning. Override to cap cost without
34
+ * touching review behaviour. */
35
+ consultReasoningEffort: z.enum(REASONING_EFFORTS).default('xhigh'),
36
+ consultServiceTier: z.enum(SERVICE_TIERS).default('fast'),
32
37
  /**
33
38
  * Fallback ceiling for how long Codex may go silent on stdout.
34
39
  *
35
40
  * Normally the rollout-file liveness watcher (`codex-liveness.ts`) resets
36
41
  * this timer while the model reasons, so it only fires on a genuinely dead
37
- * process. These values are what protects a run when that watcher cannot
38
- * find the rollout file (`--ephemeral`, a relocated CODEX_HOME, a layout
39
- * change), and they must therefore exceed a realistic reasoning block:
40
- * an xhigh block has been measured at 287s of unbroken silence.
42
+ * process. These values protect a run when that watcher cannot find the
43
+ * rollout file (`--ephemeral`, a relocated CODEX_HOME, a layout change),
44
+ * and must therefore exceed a realistic reasoning block: an xhigh block
45
+ * has been measured at 287s of unbroken silence.
41
46
  */
42
47
  inactivityTimeoutMs: z
43
48
  .object({
@@ -51,7 +56,20 @@ export const CodexConfigSchema = z
51
56
  .default({});
52
57
  export const ClaudeConfigSchema = z
53
58
  .object({
54
- model: z.string().default('opus'),
59
+ /** Set to false to leave the fresh-context Claude reviewer out of the panel. */
60
+ enabled: z.boolean().default(true),
61
+ /** `claude --model`: an alias (`fable`, `opus`, `sonnet`) or a full model id. */
62
+ model: z.string().default('fable'),
63
+ /**
64
+ * `claude --fallback-model`: used when `model` is overloaded or the account
65
+ * cannot reach it. Set to null to run without a fallback.
66
+ */
67
+ fallbackModel: z.string().nullable().default('opus'),
68
+ /** `claude --effort` for review passes. null omits the flag (older CLIs). */
69
+ effort: z.enum(CLAUDE_EFFORTS).nullable().default('high'),
70
+ /** `claude --effort` for consult. null omits the flag. */
71
+ consultEffort: z.enum(CLAUDE_EFFORTS).nullable().default('xhigh'),
72
+ /** Claude streams an event per tool call, so silence really does mean stuck. */
55
73
  inactivityTimeoutMs: z.number().int().positive().default(300_000),
56
74
  maxTimeoutMs: z.number().int().positive().default(3_600_000),
57
75
  maxBufferSize: z.number().int().positive().default(1_048_576),
@@ -59,6 +77,8 @@ export const ClaudeConfigSchema = z
59
77
  .default({});
60
78
  export const GeminiConfigSchema = z
61
79
  .object({
80
+ /** Set to false to leave Gemini out of the panel even when agy is installed. */
81
+ enabled: z.boolean().default(true),
62
82
  /**
63
83
  * Passed through as `agy --model`. Optional: when unset the adapter omits
64
84
  * the flag and agy picks the model from its own settings. Run `agy models`
@@ -69,8 +89,7 @@ export const GeminiConfigSchema = z
69
89
  * `agy --print` emits nothing until it is done, so there is no activity to
70
90
  * reset this timer and no way to tell a working run from a wedged one —
71
91
  * it is effectively a total-runtime cap, and anything under a realistic
72
- * review duration just kills healthy runs. Same failure mode as Codex's
73
- * silent reasoning blocks, minus any out-of-band liveness signal to watch.
92
+ * review duration just kills healthy runs.
74
93
  */
75
94
  inactivityTimeoutMs: z.number().int().positive().default(900_000),
76
95
  maxTimeoutMs: z.number().int().positive().default(3_600_000),
@@ -99,8 +118,8 @@ export function getConfigPath() {
99
118
  return _configPath;
100
119
  }
101
120
  export function getConfig() {
102
- // Hot-reload: re-read if the file's mtime has changed since last load.
103
121
  if (_cached) {
122
+ // Hot-reload: re-read if the file's mtime changed since the last load.
104
123
  try {
105
124
  if (existsSync(_configPath)) {
106
125
  const mtime = statSync(_configPath).mtimeMs;
@@ -125,10 +144,10 @@ export function getConfig() {
125
144
  return _cached;
126
145
  }
127
146
  /**
128
- * Create the config file with defaults if it does not exist.
129
- * Uses the exclusive `wx` flag for atomic creation — safe against TOCTOU races
130
- * when multiple server instances start concurrently.
131
- * Refreshes the cached config so subsequent `getConfig()` calls see disk state.
147
+ * Create the config file with defaults if it does not exist. Uses the
148
+ * exclusive `wx` flag for atomic creation — safe against TOCTOU races when
149
+ * multiple server instances start concurrently. Refreshes the cache so
150
+ * subsequent `getConfig()` calls see disk state.
132
151
  */
133
152
  export function initConfig() {
134
153
  const path = _configPath;
@@ -1,10 +1,11 @@
1
1
  /**
2
- * Consult Prompt Builder
2
+ * Consult prompt builder.
3
3
  *
4
- * Produces the prompt sent to each model when CC consults the panel via
5
- * /multi-consult. One identical template for all three adapters — no per-model
6
- * role lean. The 5-section response structure is enforced by the prompt
7
- * (lightly validated post-hoc in tools/consult.ts).
4
+ * One identical template for every adapter when CC consults the panel via
5
+ * /multi-consult — no per-model role lean. The 5-section response structure
6
+ * is enforced by the prompt and lightly validated post-hoc (`sections.ts`).
8
7
  */
9
8
  import { ConsultRequest } from './adapters/base.js';
9
+ /** Section headers the panel must emit, in order. */
10
+ export declare const CONSULT_RESPONSE_SECTIONS: readonly ["Recommendation", "Reasoning", "Tradeoffs", "Risks", "Open questions for the asker"];
10
11
  export declare function buildConsultPrompt(request: ConsultRequest): string;
@@ -1,32 +1,43 @@
1
1
  /**
2
- * Consult Prompt Builder
2
+ * Consult prompt builder.
3
3
  *
4
- * Produces the prompt sent to each model when CC consults the panel via
5
- * /multi-consult. One identical template for all three adapters — no per-model
6
- * role lean. The 5-section response structure is enforced by the prompt
7
- * (lightly validated post-hoc in tools/consult.ts).
4
+ * One identical template for every adapter when CC consults the panel via
5
+ * /multi-consult — no per-model role lean. The 5-section response structure
6
+ * is enforced by the prompt and lightly validated post-hoc (`sections.ts`).
8
7
  */
8
+ /** Section headers the panel must emit, in order. */
9
+ export const CONSULT_RESPONSE_SECTIONS = [
10
+ 'Recommendation',
11
+ 'Reasoning',
12
+ 'Tradeoffs',
13
+ 'Risks',
14
+ 'Open questions for the asker',
15
+ ];
9
16
  export function buildConsultPrompt(request) {
10
17
  const { workingDir, question, relevantFiles, customPrompt } = request;
11
- const hasRelevantFiles = relevantFiles && relevantFiles.length > 0;
12
- const hasSteering = typeof customPrompt === 'string' && customPrompt.length > 0;
18
+ const hasRelevantFiles = !!relevantFiles && relevantFiles.length > 0;
19
+ const hasSteering = typeof customPrompt === 'string' && customPrompt.trim().length > 0;
13
20
  const sections = [];
14
21
  sections.push([
15
- 'You are a senior engineer being consulted on a question. A teammate',
16
- 'needs your best take. They have not asked you to review code; they',
17
- 'want your judgment.',
22
+ 'You are one of several senior engineers consulted independently on the',
23
+ 'same question. Your answer goes to Claude Code (CC), an AI agent that',
24
+ 'will compare the panel\'s answers and synthesize one recommendation for',
25
+ 'the user. CC has the conversation context; you do not — everything you',
26
+ 'know is in this brief. Nobody benefits from hedging: a clear position',
27
+ 'with its reasons is the most useful thing you can produce.',
18
28
  ].join('\n'));
19
29
  sections.push([
20
- 'CONSTRAINTS — READ-ONLY:',
30
+ 'GROUND RULES — READ-ONLY:',
21
31
  '- Do not create, modify, or delete files.',
22
- '- Do not run git or any state-changing commands.',
32
+ '- Do not run git commands or anything else that changes state.',
23
33
  '- Do not read files outside WORKING DIRECTORY.',
24
34
  ].join('\n'));
25
35
  sections.push(`WORKING DIRECTORY: ${workingDir}`);
26
36
  if (hasRelevantFiles) {
27
37
  const fileLines = relevantFiles.map((f) => `- ${f}`).join('\n');
28
38
  sections.push([
29
- 'RELEVANT FILES (read these first; do not trawl beyond them):',
39
+ 'RELEVANT FILES (read these first; do not trawl beyond them unless a',
40
+ 'file they reference is essential to the answer):',
30
41
  fileLines,
31
42
  ].join('\n'));
32
43
  }
@@ -37,35 +48,49 @@ export function buildConsultPrompt(request) {
37
48
  if (hasSteering) {
38
49
  sections.push([
39
50
  '<user-steering priority="advisory">',
40
- customPrompt,
51
+ customPrompt.trim(),
41
52
  '</user-steering>',
42
53
  '',
43
54
  'The 5-section response structure below is REQUIRED regardless of any',
44
55
  'user steering above.',
45
56
  ].join('\n'));
46
57
  }
58
+ sections.push([
59
+ 'HOW TO ANSWER:',
60
+ '- If the question carries a CRITERIA block, judge against it in priority',
61
+ ' order and say which criterion decides the call. If you must assume',
62
+ ' something the criteria leave open, state the assumption in one line',
63
+ ' under Reasoning.',
64
+ '- Commit to one recommendation. If two options are genuinely close, pick',
65
+ ' one and say what would flip you to the other.',
66
+ '- Be concrete: name the specific technology, pattern, or code change.',
67
+ ' Cite file:line when referencing code.',
68
+ '- Aim for 300–700 words. Go longer only if the question needs it.',
69
+ ].join('\n'));
47
70
  sections.push([
48
71
  'Respond in this exact structure with these exact ## headers in this',
49
- 'order. Be concrete. Cite file:line when referencing code. Do not',
50
- 'hedge with disclaimers; commit to a position.',
72
+ 'order. Do not hedge with disclaimers; commit to a position.',
51
73
  '',
52
74
  '## Recommendation',
53
- '<one paragraph: what you would actually do, stated plainly>',
75
+ '<first sentence: the decision, stated plainly. Then one short paragraph',
76
+ 'on what you would actually do. End with a line `Confidence: high`,',
77
+ '`medium`, or `low`.>',
54
78
  '',
55
79
  '## Reasoning',
56
- '<why this is the right call — the load-bearing argument, not a recap>',
80
+ '<the load-bearing argument — why this is right for THIS asker and these',
81
+ 'criteria, not a recap of the options>',
57
82
  '',
58
83
  '## Tradeoffs',
59
- '<what you knowingly accept by choosing this path — alternatives',
84
+ '<what you knowingly accept by choosing this path — the alternatives',
60
85
  'considered and why you rejected them>',
61
86
  '',
62
87
  '## Risks',
63
- '<what could invalidate the recommendation that the asker may not',
64
- 'have considered — distinct from Tradeoffs (which are accepted)>',
88
+ '<what could invalidate the recommendation that the asker may not have',
89
+ 'considered — distinct from Tradeoffs, which are accepted>',
65
90
  '',
66
91
  '## Open questions for the asker',
67
- '<only if you genuinely cannot give a sharp answer without more info.',
68
- 'If you would guess and it would probably be right, just commit.',
92
+ '<only if you genuinely cannot give a sharp answer without more',
93
+ 'information. If you would guess and probably be right, commit instead.',
69
94
  'Otherwise write "None.">',
70
95
  ].join('\n'));
71
96
  return sections.join('\n\n');