@simonren/quorum 0.11.1 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/commands/multi-consult.md +1 -1
- package/commands/multi-review.md +2 -2
- package/dist/adapters/claude.js +3 -1
- package/dist/adapters/codex.js +4 -1
- package/dist/adapters/gemini.d.ts +31 -3
- package/dist/adapters/gemini.js +97 -26
- package/dist/command-hashes.d.ts +9 -0
- package/dist/command-hashes.js +40 -0
- package/dist/commands.d.ts +51 -5
- package/dist/commands.js +215 -30
- package/dist/config.d.ts +32 -28
- package/dist/config.js +7 -5
- package/dist/consult-prompt.js +5 -4
- package/dist/decoders/agy.d.ts +26 -0
- package/dist/decoders/agy.js +44 -0
- package/dist/decoders/index.d.ts +2 -0
- package/dist/decoders/index.js +1 -0
- package/dist/doctor.d.ts +9 -0
- package/dist/doctor.js +116 -3
- package/dist/executor.d.ts +10 -0
- package/dist/executor.js +50 -9
- package/dist/handoff.js +13 -13
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -10
- package/dist/server.js +18 -0
- package/dist/tools/consult.js +3 -3
- package/dist/tools/review.js +7 -7
- package/package.json +1 -1
package/dist/commands.js
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Used by index.ts (auto-install on MCP server startup and `update` subcommand)
|
|
5
5
|
*/
|
|
6
|
-
import { existsSync, mkdirSync,
|
|
6
|
+
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from 'fs';
|
|
7
7
|
import { join, dirname } from 'path';
|
|
8
8
|
import { homedir } from 'os';
|
|
9
9
|
import { fileURLToPath } from 'url';
|
|
10
|
+
import { createHash } from 'crypto';
|
|
11
|
+
import { SHIPPED_COMMAND_HASHES } from './command-hashes.js';
|
|
10
12
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
13
|
const __dirname = dirname(__filename);
|
|
12
14
|
/** Old command filenames that should be pruned on upgrade */
|
|
@@ -26,33 +28,123 @@ const DEPRECATED_COMMANDS = [
|
|
|
26
28
|
'claude-review.md',
|
|
27
29
|
];
|
|
28
30
|
/**
|
|
29
|
-
*
|
|
31
|
+
* Where each host CLI looks for the orchestration instructions.
|
|
32
|
+
*
|
|
33
|
+
* Claude Code reads flat command files from `~/.claude/commands/` and invokes
|
|
34
|
+
* them as `/multi-review`. Codex 0.155 has no custom-prompt directory — the
|
|
35
|
+
* only `prompts` it implements is the MCP protocol's — so the same content
|
|
36
|
+
* ships as a skill at `~/.codex/skills/<name>/SKILL.md`, which it loads into
|
|
37
|
+
* every session.
|
|
38
|
+
*/
|
|
39
|
+
function hostTargets() {
|
|
40
|
+
const home = homedir();
|
|
41
|
+
// `codex-liveness.ts` already honours $CODEX_HOME; stay consistent with it.
|
|
42
|
+
const codexHome = process.env.CODEX_HOME?.trim() || join(home, '.codex');
|
|
43
|
+
return [
|
|
44
|
+
{ id: 'claude', home: join(home, '.claude'), dir: join(home, '.claude', 'commands'), layout: 'command' },
|
|
45
|
+
{ id: 'codex', home: codexHome, dir: join(codexHome, 'skills'), layout: 'skill' },
|
|
46
|
+
];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Map an MCP `initialize` clientInfo.name onto a host.
|
|
50
|
+
*
|
|
51
|
+
* Measured against the real CLIs: Claude Code sends `claude-code`, Codex sends
|
|
52
|
+
* `codex-mcp-client`. An unknown client gets nothing written to disk — quorum's
|
|
53
|
+
* tools work regardless, only the slash-command shorthand is host-specific.
|
|
54
|
+
*/
|
|
55
|
+
export function hostFromClientName(name) {
|
|
56
|
+
const n = (name ?? '').toLowerCase();
|
|
57
|
+
if (n.includes('claude'))
|
|
58
|
+
return 'claude';
|
|
59
|
+
if (n.includes('codex'))
|
|
60
|
+
return 'codex';
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get source and target paths for command files.
|
|
65
|
+
*
|
|
66
|
+
* A target is included only when that host's home directory already exists —
|
|
67
|
+
* quorum never creates `~/.codex` for a user who has no Codex installed. This
|
|
68
|
+
* runs before `server.connect()`, so the MCP client identity is not available
|
|
69
|
+
* yet; directory presence is the signal.
|
|
30
70
|
*/
|
|
31
|
-
export function getCommandPaths() {
|
|
71
|
+
export function getCommandPaths(host) {
|
|
32
72
|
return {
|
|
33
73
|
source: join(__dirname, '..', 'commands'),
|
|
34
|
-
|
|
74
|
+
targets: hostTargets()
|
|
75
|
+
.filter((h) => (host ? h.id === host : existsSync(h.home)))
|
|
76
|
+
.map((h) => h.dir),
|
|
35
77
|
};
|
|
36
78
|
}
|
|
79
|
+
/** The layout a target directory uses, by its path. Defaults to flat commands. */
|
|
80
|
+
function layoutFor(target) {
|
|
81
|
+
return hostTargets().find((h) => h.dir === target)?.layout ?? 'command';
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Rewrite a Claude Code command file as a Codex skill.
|
|
85
|
+
*
|
|
86
|
+
* A skill's frontmatter is `name` + `description`; `argument-hint` is not a
|
|
87
|
+
* skill field, and `$ARGUMENTS` is not substituted the way a slash command
|
|
88
|
+
* substitutes it, so the body refers to the request in prose instead.
|
|
89
|
+
*/
|
|
90
|
+
export function toSkill(name, body) {
|
|
91
|
+
const fm = body.match(/^---\n([\s\S]*?)\n---\n?/);
|
|
92
|
+
const description = fm?.[1].match(/^description:\s*(.+)$/m)?.[1].trim() ?? name;
|
|
93
|
+
const rest = (fm ? body.slice(fm[0].length) : body).replace(/\$ARGUMENTS/g, 'the request you were given');
|
|
94
|
+
return `---\nname: ${name}\ndescription: ${description}\n---\n${rest.startsWith('\n') ? '' : '\n'}${rest}`;
|
|
95
|
+
}
|
|
37
96
|
/**
|
|
38
|
-
* Install
|
|
97
|
+
* Install the orchestration instructions for a host CLI.
|
|
39
98
|
*
|
|
40
|
-
*
|
|
99
|
+
* With `host`, only that host's directory is written — the server uses this so
|
|
100
|
+
* a session never writes into a CLI that is merely installed as a *reviewer*.
|
|
101
|
+
* Without it (the `quorum update` subcommand, an explicit user action), every
|
|
102
|
+
* host present on the machine is written.
|
|
103
|
+
*
|
|
104
|
+
* @param overrides Test-only path overrides; production callers pass `host`.
|
|
105
|
+
* A `target` override collapses the install to that single directory.
|
|
41
106
|
* @returns Result object with success status and installed commands
|
|
42
107
|
*/
|
|
43
108
|
export function installCommands(overrides) {
|
|
44
|
-
const defaults = getCommandPaths();
|
|
109
|
+
const defaults = getCommandPaths(overrides?.host);
|
|
45
110
|
const source = overrides?.source ?? defaults.source;
|
|
46
|
-
const
|
|
47
|
-
// Check source exists
|
|
111
|
+
const targets = overrides?.target ? [overrides.target] : defaults.targets;
|
|
48
112
|
if (!existsSync(source)) {
|
|
49
|
-
return { success: false, installed: [], removed: [], error: 'Commands directory not found' };
|
|
113
|
+
return { success: false, installed: [], removed: [], targets: [], skipped: [], error: 'Commands directory not found' };
|
|
114
|
+
}
|
|
115
|
+
const files = readdirSync(source).filter((f) => f.endsWith('.md'));
|
|
116
|
+
if (files.length === 0) {
|
|
117
|
+
return { success: false, installed: [], removed: [], targets: [], skipped: [], error: 'No command files found' };
|
|
118
|
+
}
|
|
119
|
+
const installed = new Set();
|
|
120
|
+
const removed = new Set();
|
|
121
|
+
const skipped = new Set();
|
|
122
|
+
const written = [];
|
|
123
|
+
const failures = [];
|
|
124
|
+
// One unwritable host must not deny the others: keep going and report.
|
|
125
|
+
for (const target of targets) {
|
|
126
|
+
const outcome = installTo(source, target, files, installed, removed, skipped);
|
|
127
|
+
if (outcome.ok)
|
|
128
|
+
written.push(target);
|
|
129
|
+
else
|
|
130
|
+
failures.push(`${target}: ${outcome.error}`);
|
|
50
131
|
}
|
|
132
|
+
return {
|
|
133
|
+
success: written.length > 0 || targets.length === 0,
|
|
134
|
+
installed: [...installed],
|
|
135
|
+
removed: [...removed],
|
|
136
|
+
targets: written,
|
|
137
|
+
skipped: [...skipped],
|
|
138
|
+
...(failures.length > 0 ? { error: failures.join('; ') } : {}),
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/** Install the command set into one host directory. Mutates the shared name sets. */
|
|
142
|
+
function installTo(source, target, files, installed, removed, skipped) {
|
|
51
143
|
// Create target directory, handle errors (not a dir, permission denied)
|
|
52
144
|
try {
|
|
53
145
|
if (existsSync(target)) {
|
|
54
146
|
if (!statSync(target).isDirectory()) {
|
|
55
|
-
return {
|
|
147
|
+
return { ok: false, error: `${target} exists but is not a directory` };
|
|
56
148
|
}
|
|
57
149
|
}
|
|
58
150
|
else {
|
|
@@ -61,19 +153,31 @@ export function installCommands(overrides) {
|
|
|
61
153
|
}
|
|
62
154
|
catch (err) {
|
|
63
155
|
const msg = err instanceof Error ? err.message : String(err);
|
|
64
|
-
return {
|
|
156
|
+
return { ok: false, error: `Cannot create target directory: ${msg}` };
|
|
65
157
|
}
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
//
|
|
71
|
-
//
|
|
72
|
-
//
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
158
|
+
const layout = layoutFor(target);
|
|
159
|
+
// Prune deprecated commands by renaming to .deprecated.bak (lossless —
|
|
160
|
+
// preserves any user edits the operator made). If the backup already exists
|
|
161
|
+
// from a previous upgrade, leave it alone.
|
|
162
|
+
//
|
|
163
|
+
// Only in the flat command layout: these names were never installed anywhere
|
|
164
|
+
// else, so a `codex.md` in another host's directory is somebody else's file.
|
|
165
|
+
if (layout === 'command') {
|
|
166
|
+
for (const oldFile of DEPRECATED_COMMANDS) {
|
|
167
|
+
const oldPath = join(target, oldFile);
|
|
168
|
+
if (!existsSync(oldPath))
|
|
169
|
+
continue;
|
|
170
|
+
// A name we retired is not proof the file is ours — `codex.md` is a
|
|
171
|
+
// plausible thing for an operator to write. Only rename our own.
|
|
172
|
+
try {
|
|
173
|
+
if (!isOurContent(readFileSync(oldPath))) {
|
|
174
|
+
skipped.add(oldPath);
|
|
175
|
+
continue;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
continue;
|
|
180
|
+
}
|
|
77
181
|
const backupPath = `${oldPath}.deprecated.bak`;
|
|
78
182
|
try {
|
|
79
183
|
if (!existsSync(backupPath)) {
|
|
@@ -82,24 +186,105 @@ export function installCommands(overrides) {
|
|
|
82
186
|
// If the backup already exists, the original was already moved on a
|
|
83
187
|
// prior install. The file we see now must be a recreation; leave it
|
|
84
188
|
// alone — the user clearly wants it.
|
|
85
|
-
removed.
|
|
189
|
+
removed.add(oldFile.replace('.md', ''));
|
|
86
190
|
}
|
|
87
191
|
catch {
|
|
88
192
|
// Best-effort removal — don't fail the install
|
|
89
193
|
}
|
|
90
194
|
}
|
|
91
195
|
}
|
|
92
|
-
// Copy current files
|
|
93
|
-
const installed = [];
|
|
94
196
|
try {
|
|
95
197
|
for (const file of files) {
|
|
96
|
-
|
|
97
|
-
|
|
198
|
+
const name = file.replace('.md', '');
|
|
199
|
+
const dest = layout === 'skill' ? join(target, name, 'SKILL.md') : join(target, file);
|
|
200
|
+
if (!isOursOrAbsent(dest)) {
|
|
201
|
+
skipped.add(dest); // never clobber a file we did not write
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
const body = readFileSync(join(source, file), 'utf-8');
|
|
205
|
+
if (layout === 'skill')
|
|
206
|
+
mkdirSync(join(target, name), { recursive: true });
|
|
207
|
+
writeAtomic(dest, stamp(layout === 'skill' ? toSkill(name, body) : body));
|
|
208
|
+
installed.add(name);
|
|
98
209
|
}
|
|
99
210
|
}
|
|
100
211
|
catch (err) {
|
|
101
212
|
const msg = err instanceof Error ? err.message : String(err);
|
|
102
|
-
return {
|
|
213
|
+
return { ok: false, error: `Copy failed: ${msg}` };
|
|
214
|
+
}
|
|
215
|
+
return { ok: true };
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Stamped into every file quorum writes, so a later install can recognize its
|
|
219
|
+
* own work without guessing. Must never change: older installs are identified
|
|
220
|
+
* by this exact string.
|
|
221
|
+
*/
|
|
222
|
+
export const PROVENANCE_MARKER = '<!-- installed by quorum; edits are overwritten on upgrade -->';
|
|
223
|
+
/** Add the provenance marker directly below the frontmatter, or at the top. */
|
|
224
|
+
function stamp(body) {
|
|
225
|
+
if (body.includes(PROVENANCE_MARKER))
|
|
226
|
+
return body;
|
|
227
|
+
const fm = body.match(/^---\n[\s\S]*?\n---\n/);
|
|
228
|
+
return fm
|
|
229
|
+
? `${fm[0]}${PROVENANCE_MARKER}\n${body.slice(fm[0].length)}`
|
|
230
|
+
: `${PROVENANCE_MARKER}\n${body}`;
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* True when `dest` is absent or is a file quorum may overwrite.
|
|
234
|
+
*
|
|
235
|
+
* These directories belong to the host CLIs, not to quorum, so a name collision
|
|
236
|
+
* with the operator's own `multi-review.md` must not destroy it. Exactly two
|
|
237
|
+
* things count as ours:
|
|
238
|
+
*
|
|
239
|
+
* 1. the provenance marker — written by this version onward;
|
|
240
|
+
* 2. byte-identical to a file some quorum release shipped, which is how an
|
|
241
|
+
* install from before the marker is recognized.
|
|
242
|
+
*
|
|
243
|
+
* Both are exact. An earlier attempt guessed from the reserved `[flex]`/
|
|
244
|
+
* `[xhigh]` vocabulary, but only v0.11.x ever carried it: every release from
|
|
245
|
+
* v0.7.0 to v6.2.0 would have been stranded un-upgradeable. Anything that
|
|
246
|
+
* matches neither signal is somebody else's file, left alone and reported.
|
|
247
|
+
*/
|
|
248
|
+
function isOursOrAbsent(dest) {
|
|
249
|
+
if (!existsSync(dest))
|
|
250
|
+
return true;
|
|
251
|
+
try {
|
|
252
|
+
return isOurContent(readFileSync(dest));
|
|
253
|
+
}
|
|
254
|
+
catch {
|
|
255
|
+
return false;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* True when these bytes are a marked file, or one quorum shipped verbatim.
|
|
260
|
+
*
|
|
261
|
+
* `known` is injectable so the identity rule can be tested without depending
|
|
262
|
+
* on the generated manifest's current contents.
|
|
263
|
+
*/
|
|
264
|
+
export function isOurContent(body, known = SHIPPED_COMMAND_HASHES) {
|
|
265
|
+
if (body.includes(PROVENANCE_MARKER))
|
|
266
|
+
return true;
|
|
267
|
+
return known.has(createHash('sha256').update(body).digest('hex'));
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Write `body` to `dest` atomically.
|
|
271
|
+
*
|
|
272
|
+
* A crashed or short write must never leave a truncated file behind: that file
|
|
273
|
+
* would lack the provenance marker, so every later install would treat it as
|
|
274
|
+
* the user's own and refuse to repair it. Rename within the same directory is
|
|
275
|
+
* atomic, so `dest` is either the old content or the new one.
|
|
276
|
+
*/
|
|
277
|
+
function writeAtomic(dest, body) {
|
|
278
|
+
const tmp = `${dest}.quorum-${process.pid}.tmp`;
|
|
279
|
+
try {
|
|
280
|
+
writeFileSync(tmp, body);
|
|
281
|
+
renameSync(tmp, dest);
|
|
282
|
+
}
|
|
283
|
+
catch (err) {
|
|
284
|
+
try {
|
|
285
|
+
rmSync(tmp, { force: true });
|
|
286
|
+
}
|
|
287
|
+
catch { /* best effort */ }
|
|
288
|
+
throw err;
|
|
103
289
|
}
|
|
104
|
-
return { success: true, installed, removed };
|
|
105
290
|
}
|
package/dist/config.d.ts
CHANGED
|
@@ -122,10 +122,12 @@ export declare const GeminiConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
122
122
|
*/
|
|
123
123
|
model: z.ZodOptional<z.ZodString>;
|
|
124
124
|
/**
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
125
|
+
* agy streams an event per model turn and per tool call, so this is the
|
|
126
|
+
* longest silent gap allowed. Measured over 311 quorum runs (34k steps):
|
|
127
|
+
* the longest healthy step took 213s, and agy restarts a stalled model
|
|
128
|
+
* stream itself after ~604s ("The stream was interrupted"). Stay above
|
|
129
|
+
* that, or quorum kills runs agy was about to recover. `maxTimeoutMs`
|
|
130
|
+
* caps the whole run and is also passed as agy's `--print-timeout`.
|
|
129
131
|
*/
|
|
130
132
|
inactivityTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
131
133
|
maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
@@ -251,10 +253,12 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
251
253
|
*/
|
|
252
254
|
model: z.ZodOptional<z.ZodString>;
|
|
253
255
|
/**
|
|
254
|
-
*
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
256
|
+
* agy streams an event per model turn and per tool call, so this is the
|
|
257
|
+
* longest silent gap allowed. Measured over 311 quorum runs (34k steps):
|
|
258
|
+
* the longest healthy step took 213s, and agy restarts a stalled model
|
|
259
|
+
* stream itself after ~604s ("The stream was interrupted"). Stay above
|
|
260
|
+
* that, or quorum kills runs agy was about to recover. `maxTimeoutMs`
|
|
261
|
+
* caps the whole run and is also passed as agy's `--print-timeout`.
|
|
258
262
|
*/
|
|
259
263
|
inactivityTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
260
264
|
maxTimeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
@@ -273,6 +277,16 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
273
277
|
maxBufferSize?: number | undefined;
|
|
274
278
|
}>>;
|
|
275
279
|
}, "strip", z.ZodTypeAny, {
|
|
280
|
+
claude: {
|
|
281
|
+
enabled: boolean;
|
|
282
|
+
model: string;
|
|
283
|
+
inactivityTimeoutMs: number;
|
|
284
|
+
maxTimeoutMs: number;
|
|
285
|
+
maxBufferSize: number;
|
|
286
|
+
fallbackModel: string | null;
|
|
287
|
+
effort: "high" | "xhigh" | "low" | "medium" | "max" | null;
|
|
288
|
+
consultEffort: "high" | "xhigh" | "low" | "medium" | "max" | null;
|
|
289
|
+
};
|
|
276
290
|
codex: {
|
|
277
291
|
enabled: boolean;
|
|
278
292
|
model: string;
|
|
@@ -287,16 +301,6 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
287
301
|
maxTimeoutMs: number;
|
|
288
302
|
maxBufferSize: number;
|
|
289
303
|
};
|
|
290
|
-
claude: {
|
|
291
|
-
enabled: boolean;
|
|
292
|
-
model: string;
|
|
293
|
-
inactivityTimeoutMs: number;
|
|
294
|
-
maxTimeoutMs: number;
|
|
295
|
-
maxBufferSize: number;
|
|
296
|
-
fallbackModel: string | null;
|
|
297
|
-
effort: "high" | "xhigh" | "low" | "medium" | "max" | null;
|
|
298
|
-
consultEffort: "high" | "xhigh" | "low" | "medium" | "max" | null;
|
|
299
|
-
};
|
|
300
304
|
gemini: {
|
|
301
305
|
enabled: boolean;
|
|
302
306
|
inactivityTimeoutMs: number;
|
|
@@ -305,6 +309,16 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
305
309
|
model?: string | undefined;
|
|
306
310
|
};
|
|
307
311
|
}, {
|
|
312
|
+
claude?: {
|
|
313
|
+
enabled?: boolean | undefined;
|
|
314
|
+
model?: string | undefined;
|
|
315
|
+
inactivityTimeoutMs?: number | undefined;
|
|
316
|
+
maxTimeoutMs?: number | undefined;
|
|
317
|
+
maxBufferSize?: number | undefined;
|
|
318
|
+
fallbackModel?: string | null | undefined;
|
|
319
|
+
effort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
|
|
320
|
+
consultEffort?: "high" | "xhigh" | "low" | "medium" | "max" | null | undefined;
|
|
321
|
+
} | undefined;
|
|
308
322
|
codex?: {
|
|
309
323
|
enabled?: boolean | undefined;
|
|
310
324
|
model?: string | undefined;
|
|
@@ -319,16 +333,6 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
319
333
|
maxTimeoutMs?: number | undefined;
|
|
320
334
|
maxBufferSize?: number | undefined;
|
|
321
335
|
} | undefined;
|
|
322
|
-
claude?: {
|
|
323
|
-
enabled?: boolean | undefined;
|
|
324
|
-
model?: string | undefined;
|
|
325
|
-
inactivityTimeoutMs?: number | undefined;
|
|
326
|
-
maxTimeoutMs?: number | undefined;
|
|
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;
|
|
331
|
-
} | undefined;
|
|
332
336
|
gemini?: {
|
|
333
337
|
enabled?: boolean | undefined;
|
|
334
338
|
model?: string | undefined;
|
package/dist/config.js
CHANGED
|
@@ -86,12 +86,14 @@ export const GeminiConfigSchema = z
|
|
|
86
86
|
*/
|
|
87
87
|
model: z.string().optional(),
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
89
|
+
* agy streams an event per model turn and per tool call, so this is the
|
|
90
|
+
* longest silent gap allowed. Measured over 311 quorum runs (34k steps):
|
|
91
|
+
* the longest healthy step took 213s, and agy restarts a stalled model
|
|
92
|
+
* stream itself after ~604s ("The stream was interrupted"). Stay above
|
|
93
|
+
* that, or quorum kills runs agy was about to recover. `maxTimeoutMs`
|
|
94
|
+
* caps the whole run and is also passed as agy's `--print-timeout`.
|
|
93
95
|
*/
|
|
94
|
-
inactivityTimeoutMs: z.number().int().positive().default(
|
|
96
|
+
inactivityTimeoutMs: z.number().int().positive().default(720_000),
|
|
95
97
|
maxTimeoutMs: z.number().int().positive().default(3_600_000),
|
|
96
98
|
maxBufferSize: z.number().int().positive().default(1_048_576),
|
|
97
99
|
})
|
package/dist/consult-prompt.js
CHANGED
|
@@ -20,10 +20,11 @@ export function buildConsultPrompt(request) {
|
|
|
20
20
|
const sections = [];
|
|
21
21
|
sections.push([
|
|
22
22
|
'You are one of several senior engineers consulted independently on the',
|
|
23
|
-
'same question. Your answer goes to
|
|
24
|
-
'will compare the panel\'s answers and synthesize one
|
|
25
|
-
'the user.
|
|
26
|
-
'know is in this brief. Nobody benefits from
|
|
23
|
+
'same question. Your answer goes to the requesting agent, an AI coding',
|
|
24
|
+
'agent that will compare the panel\'s answers and synthesize one',
|
|
25
|
+
'recommendation for the user. It has the conversation context; you do',
|
|
26
|
+
'not — everything you know is in this brief. Nobody benefits from',
|
|
27
|
+
'hedging: a clear position',
|
|
27
28
|
'with its reasons is the most useful thing you can produce.',
|
|
28
29
|
].join('\n'));
|
|
29
30
|
sections.push([
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgyEventDecoder — Parses `agy --print --output-format stream-json` NDJSON.
|
|
3
|
+
*
|
|
4
|
+
* Event stream format (agy 1.3.3):
|
|
5
|
+
* {"event":"init","conversation_id":"…","init":{"model":"…","cwd":"…","tools":[…]}}
|
|
6
|
+
* {"event":"step_update","step_update":{"step_index":2,"state":"DONE","step_type":"tool","tool_name":"view_file",…}}
|
|
7
|
+
* {"event":"result","result":{"status":"SUCCESS","response":"…"}}
|
|
8
|
+
* {"event":"result","result":{"status":"ERROR","response":"","error":"invalid model selection …"}}
|
|
9
|
+
*
|
|
10
|
+
* One `step_update` arrives per model turn and per tool call, so the stream is
|
|
11
|
+
* itself the liveness signal; only the `result` event carries the answer.
|
|
12
|
+
*/
|
|
13
|
+
export interface AgyResult {
|
|
14
|
+
status: string;
|
|
15
|
+
response: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
export declare class AgyEventDecoder {
|
|
19
|
+
private _result;
|
|
20
|
+
private _steps;
|
|
21
|
+
processLine(line: string): void;
|
|
22
|
+
/** The final `result` event, or null when agy never sent one. */
|
|
23
|
+
getResult(): AgyResult | null;
|
|
24
|
+
/** Number of `step_update` events seen — model turns and tool calls. */
|
|
25
|
+
getStepCount(): number;
|
|
26
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgyEventDecoder — Parses `agy --print --output-format stream-json` NDJSON.
|
|
3
|
+
*
|
|
4
|
+
* Event stream format (agy 1.3.3):
|
|
5
|
+
* {"event":"init","conversation_id":"…","init":{"model":"…","cwd":"…","tools":[…]}}
|
|
6
|
+
* {"event":"step_update","step_update":{"step_index":2,"state":"DONE","step_type":"tool","tool_name":"view_file",…}}
|
|
7
|
+
* {"event":"result","result":{"status":"SUCCESS","response":"…"}}
|
|
8
|
+
* {"event":"result","result":{"status":"ERROR","response":"","error":"invalid model selection …"}}
|
|
9
|
+
*
|
|
10
|
+
* One `step_update` arrives per model turn and per tool call, so the stream is
|
|
11
|
+
* itself the liveness signal; only the `result` event carries the answer.
|
|
12
|
+
*/
|
|
13
|
+
export class AgyEventDecoder {
|
|
14
|
+
_result = null;
|
|
15
|
+
_steps = 0;
|
|
16
|
+
processLine(line) {
|
|
17
|
+
let event;
|
|
18
|
+
try {
|
|
19
|
+
event = JSON.parse(line);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (typeof event !== 'object' || event === null)
|
|
25
|
+
return;
|
|
26
|
+
if (event.event === 'step_update')
|
|
27
|
+
this._steps++;
|
|
28
|
+
if (event.event === 'result' && event.result) {
|
|
29
|
+
this._result = {
|
|
30
|
+
status: String(event.result.status ?? ''),
|
|
31
|
+
response: typeof event.result.response === 'string' ? event.result.response : '',
|
|
32
|
+
...(typeof event.result.error === 'string' && event.result.error ? { error: event.result.error } : {}),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/** The final `result` event, or null when agy never sent one. */
|
|
37
|
+
getResult() {
|
|
38
|
+
return this._result;
|
|
39
|
+
}
|
|
40
|
+
/** Number of `step_update` events seen — model turns and tool calls. */
|
|
41
|
+
getStepCount() {
|
|
42
|
+
return this._steps;
|
|
43
|
+
}
|
|
44
|
+
}
|
package/dist/decoders/index.d.ts
CHANGED
|
@@ -2,3 +2,5 @@ export { CodexEventDecoder } from './codex.js';
|
|
|
2
2
|
export type { CodexEvent } from './codex.js';
|
|
3
3
|
export { ClaudeEventDecoder } from './claude.js';
|
|
4
4
|
export type { ClaudeEvent } from './claude.js';
|
|
5
|
+
export { AgyEventDecoder } from './agy.js';
|
|
6
|
+
export type { AgyResult } from './agy.js';
|
package/dist/decoders/index.js
CHANGED
package/dist/doctor.d.ts
CHANGED
|
@@ -16,5 +16,14 @@ export declare function collectAdapterStatus(options?: {
|
|
|
16
16
|
}): Promise<AdapterStatus[]>;
|
|
17
17
|
/** Start-up log on stderr (stdout is the MCP transport). */
|
|
18
18
|
export declare function logCliStatus(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* agy's `toolPermission: always-proceed` approves the model's own requests to
|
|
21
|
+
* run a command outside the terminal sandbox, so `--sandbox` stops nothing.
|
|
22
|
+
* Under `proceed-in-sandbox` sandboxed commands still run unasked and print
|
|
23
|
+
* mode denies the bypass. agy has no per-run flag for this, so it is the
|
|
24
|
+
* user's setting to change.
|
|
25
|
+
*/
|
|
26
|
+
export declare function checkAgyToolPermission(settingsPath?: string): string[];
|
|
27
|
+
export declare function checkCodexHostConfig(configPath?: string): string[];
|
|
19
28
|
/** `quorum doctor`: full report on stdout. Returns the process exit code. */
|
|
20
29
|
export declare function runDoctor(version: string): Promise<number>;
|