@simonren/quorum 0.9.0 → 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 -20
  13. package/dist/adapters/gemini.js +56 -148
  14. package/dist/adapters/index.d.ts +8 -5
  15. package/dist/adapters/index.js +7 -8
  16. package/dist/config.d.ts +116 -28
  17. package/dist/config.js +50 -28
  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,49 +76,83 @@ 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>;
118
+ /**
119
+ * Passed through as `agy --model`. Optional: when unset the adapter omits
120
+ * the flag and agy picks the model from its own settings. Run `agy models`
121
+ * for valid ids (they encode the reasoning effort, e.g. `-high`).
122
+ */
123
+ model: z.ZodOptional<z.ZodString>;
89
124
  /**
90
125
  * `agy --print` emits nothing until it is done, so there is no activity to
91
126
  * reset this timer and no way to tell a working run from a wedged one —
92
127
  * it is effectively a total-runtime cap, and anything under a realistic
93
- * review duration just kills healthy runs. Same failure mode as Codex's
94
- * silent reasoning blocks, minus any out-of-band liveness signal to watch.
128
+ * review duration just kills healthy runs.
95
129
  */
96
130
  inactivityTimeoutMs: z.ZodDefault<z.ZodNumber>;
97
131
  maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
98
132
  maxBufferSize: z.ZodDefault<z.ZodNumber>;
99
133
  }, "strip", z.ZodTypeAny, {
134
+ enabled: boolean;
100
135
  inactivityTimeoutMs: number;
101
136
  maxTimeoutMs: number;
102
137
  maxBufferSize: number;
138
+ model?: string | undefined;
103
139
  }, {
140
+ enabled?: boolean | undefined;
141
+ model?: string | undefined;
104
142
  inactivityTimeoutMs?: number | undefined;
105
143
  maxTimeoutMs?: number | undefined;
106
144
  maxBufferSize?: number | undefined;
107
145
  }>>;
108
146
  export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
109
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>;
110
150
  model: z.ZodDefault<z.ZodString>;
111
151
  reasoningEffort: z.ZodDefault<z.ZodEnum<["high", "xhigh"]>>;
112
152
  serviceTier: z.ZodDefault<z.ZodEnum<["default", "fast", "flex"]>>;
113
- /** Consult-specific defaults — separate from review knobs because consult
114
- * questions are deeper and warrant more reasoning. Users can override
115
- * 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. */
116
156
  consultReasoningEffort: z.ZodDefault<z.ZodEnum<["high", "xhigh"]>>;
117
157
  consultServiceTier: z.ZodDefault<z.ZodEnum<["default", "fast", "flex"]>>;
118
158
  /**
@@ -120,10 +160,10 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
120
160
  *
121
161
  * Normally the rollout-file liveness watcher (`codex-liveness.ts`) resets
122
162
  * this timer while the model reasons, so it only fires on a genuinely dead
123
- * process. These values are what protects a run when that watcher cannot
124
- * find the rollout file (`--ephemeral`, a relocated CODEX_HOME, a layout
125
- * change), and they must therefore exceed a realistic reasoning block:
126
- * 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.
127
167
  */
128
168
  inactivityTimeoutMs: z.ZodDefault<z.ZodObject<{
129
169
  high: z.ZodDefault<z.ZodNumber>;
@@ -138,6 +178,7 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
138
178
  maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
139
179
  maxBufferSize: z.ZodDefault<z.ZodNumber>;
140
180
  }, "strip", z.ZodTypeAny, {
181
+ enabled: boolean;
141
182
  model: string;
142
183
  reasoningEffort: "high" | "xhigh";
143
184
  serviceTier: "default" | "fast" | "flex";
@@ -150,6 +191,7 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
150
191
  maxTimeoutMs: number;
151
192
  maxBufferSize: number;
152
193
  }, {
194
+ enabled?: boolean | undefined;
153
195
  model?: string | undefined;
154
196
  reasoningEffort?: "high" | "xhigh" | undefined;
155
197
  serviceTier?: "default" | "fast" | "flex" | undefined;
@@ -163,43 +205,76 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
163
205
  maxBufferSize?: number | undefined;
164
206
  }>>;
165
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. */
166
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. */
167
222
  inactivityTimeoutMs: z.ZodDefault<z.ZodNumber>;
168
223
  maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
169
224
  maxBufferSize: z.ZodDefault<z.ZodNumber>;
170
225
  }, "strip", z.ZodTypeAny, {
226
+ enabled: boolean;
171
227
  model: string;
172
228
  inactivityTimeoutMs: number;
173
229
  maxTimeoutMs: number;
174
230
  maxBufferSize: number;
231
+ fallbackModel: string | null;
232
+ effort: "high" | "xhigh" | "low" | "medium" | "max" | null;
233
+ consultEffort: "high" | "xhigh" | "low" | "medium" | "max" | null;
175
234
  }, {
235
+ enabled?: boolean | undefined;
176
236
  model?: string | undefined;
177
237
  inactivityTimeoutMs?: number | undefined;
178
238
  maxTimeoutMs?: number | undefined;
179
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;
180
243
  }>>;
181
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>;
247
+ /**
248
+ * Passed through as `agy --model`. Optional: when unset the adapter omits
249
+ * the flag and agy picks the model from its own settings. Run `agy models`
250
+ * for valid ids (they encode the reasoning effort, e.g. `-high`).
251
+ */
252
+ model: z.ZodOptional<z.ZodString>;
182
253
  /**
183
254
  * `agy --print` emits nothing until it is done, so there is no activity to
184
255
  * reset this timer and no way to tell a working run from a wedged one —
185
256
  * it is effectively a total-runtime cap, and anything under a realistic
186
- * review duration just kills healthy runs. Same failure mode as Codex's
187
- * silent reasoning blocks, minus any out-of-band liveness signal to watch.
257
+ * review duration just kills healthy runs.
188
258
  */
189
259
  inactivityTimeoutMs: z.ZodDefault<z.ZodNumber>;
190
260
  maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
191
261
  maxBufferSize: z.ZodDefault<z.ZodNumber>;
192
262
  }, "strip", z.ZodTypeAny, {
263
+ enabled: boolean;
193
264
  inactivityTimeoutMs: number;
194
265
  maxTimeoutMs: number;
195
266
  maxBufferSize: number;
267
+ model?: string | undefined;
196
268
  }, {
269
+ enabled?: boolean | undefined;
270
+ model?: string | undefined;
197
271
  inactivityTimeoutMs?: number | undefined;
198
272
  maxTimeoutMs?: number | undefined;
199
273
  maxBufferSize?: number | undefined;
200
274
  }>>;
201
275
  }, "strip", z.ZodTypeAny, {
202
276
  codex: {
277
+ enabled: boolean;
203
278
  model: string;
204
279
  reasoningEffort: "high" | "xhigh";
205
280
  serviceTier: "default" | "fast" | "flex";
@@ -213,18 +288,25 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
213
288
  maxBufferSize: number;
214
289
  };
215
290
  claude: {
291
+ enabled: boolean;
216
292
  model: string;
217
293
  inactivityTimeoutMs: number;
218
294
  maxTimeoutMs: number;
219
295
  maxBufferSize: number;
296
+ fallbackModel: string | null;
297
+ effort: "high" | "xhigh" | "low" | "medium" | "max" | null;
298
+ consultEffort: "high" | "xhigh" | "low" | "medium" | "max" | null;
220
299
  };
221
300
  gemini: {
301
+ enabled: boolean;
222
302
  inactivityTimeoutMs: number;
223
303
  maxTimeoutMs: number;
224
304
  maxBufferSize: number;
305
+ model?: string | undefined;
225
306
  };
226
307
  }, {
227
308
  codex?: {
309
+ enabled?: boolean | undefined;
228
310
  model?: string | undefined;
229
311
  reasoningEffort?: "high" | "xhigh" | undefined;
230
312
  serviceTier?: "default" | "fast" | "flex" | undefined;
@@ -238,12 +320,18 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
238
320
  maxBufferSize?: number | undefined;
239
321
  } | undefined;
240
322
  claude?: {
323
+ enabled?: boolean | undefined;
241
324
  model?: string | undefined;
242
325
  inactivityTimeoutMs?: number | undefined;
243
326
  maxTimeoutMs?: number | undefined;
244
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;
245
331
  } | undefined;
246
332
  gemini?: {
333
+ enabled?: boolean | undefined;
334
+ model?: string | undefined;
247
335
  inactivityTimeoutMs?: number | undefined;
248
336
  maxTimeoutMs?: number | undefined;
249
337
  maxBufferSize?: number | undefined;
@@ -257,10 +345,10 @@ export declare const DEFAULT_CONFIG: Config;
257
345
  export declare function getConfigPath(): string;
258
346
  export declare function getConfig(): Config;
259
347
  /**
260
- * Create the config file with defaults if it does not exist.
261
- * Uses the exclusive `wx` flag for atomic creation — safe against TOCTOU races
262
- * when multiple server instances start concurrently.
263
- * 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.
264
352
  */
265
353
  export declare function initConfig(): {
266
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,23 +56,40 @@ 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),
58
76
  })
59
77
  .default({});
60
- // agy (Antigravity CLI) does not expose `--model`; model selection lives in
61
- // agy's own settings file. We keep the timeout/buffer knobs because CliExecutor
62
- // enforces them regardless of the underlying CLI.
63
78
  export const GeminiConfigSchema = z
64
79
  .object({
80
+ /** Set to false to leave Gemini out of the panel even when agy is installed. */
81
+ enabled: z.boolean().default(true),
82
+ /**
83
+ * Passed through as `agy --model`. Optional: when unset the adapter omits
84
+ * the flag and agy picks the model from its own settings. Run `agy models`
85
+ * for valid ids (they encode the reasoning effort, e.g. `-high`).
86
+ */
87
+ model: z.string().optional(),
65
88
  /**
66
89
  * `agy --print` emits nothing until it is done, so there is no activity to
67
90
  * reset this timer and no way to tell a working run from a wedged one —
68
91
  * it is effectively a total-runtime cap, and anything under a realistic
69
- * review duration just kills healthy runs. Same failure mode as Codex's
70
- * silent reasoning blocks, minus any out-of-band liveness signal to watch.
92
+ * review duration just kills healthy runs.
71
93
  */
72
94
  inactivityTimeoutMs: z.number().int().positive().default(900_000),
73
95
  maxTimeoutMs: z.number().int().positive().default(3_600_000),
@@ -96,8 +118,8 @@ export function getConfigPath() {
96
118
  return _configPath;
97
119
  }
98
120
  export function getConfig() {
99
- // Hot-reload: re-read if the file's mtime has changed since last load.
100
121
  if (_cached) {
122
+ // Hot-reload: re-read if the file's mtime changed since the last load.
101
123
  try {
102
124
  if (existsSync(_configPath)) {
103
125
  const mtime = statSync(_configPath).mtimeMs;
@@ -122,10 +144,10 @@ export function getConfig() {
122
144
  return _cached;
123
145
  }
124
146
  /**
125
- * Create the config file with defaults if it does not exist.
126
- * Uses the exclusive `wx` flag for atomic creation — safe against TOCTOU races
127
- * when multiple server instances start concurrently.
128
- * 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.
129
151
  */
130
152
  export function initConfig() {
131
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');