@simonren/quorum 0.12.0 → 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/dist/adapters/claude.js +3 -1
- package/dist/adapters/codex.js +3 -1
- package/dist/adapters/gemini.d.ts +31 -3
- package/dist/adapters/gemini.js +97 -26
- package/dist/config.d.ts +12 -8
- package/dist/config.js +7 -5
- 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 +8 -0
- package/dist/doctor.js +30 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ You have a question → /multi-consult → question + criteria → Codex, Gemi
|
|
|
83
83
|
|
|
84
84
|
**Key principles:**
|
|
85
85
|
- **Claude Code is primary.** External models assist; Claude Code verifies and decides.
|
|
86
|
-
- **Working-directory strategy.** Claude Code passes the cwd and a small brief; reviewers read the files themselves. Read-only by contract: Codex runs with `--sandbox read-only`; Claude runs in default permission mode with prompts disabled, write and agent tools removed, and only read-only `git` allowed in Bash; agy runs with `--sandbox
|
|
86
|
+
- **Working-directory strategy.** Claude Code passes the cwd and a small brief; reviewers read the files themselves. Read-only by contract: Codex runs with `--sandbox read-only`; Claude runs in default permission mode with prompts disabled, write and agent tools removed, and only read-only `git` allowed in Bash; agy runs with `--sandbox`, which covers only its terminal, and agy lets the model rerun a command outside it unless agy's `toolPermission` is `proceed-in-sandbox` (`doctor` warns on `always-proceed`). agy cannot make its file tools read-only, so quorum fingerprints the working tree (`git status`) before and after every run and flags any change at the top of the result.
|
|
87
87
|
- **Structured, verifiable answers.** Reviewers respond with `Verdict` / `Findings` (severity, location, evidence, impact, fix, confidence) / `Answers` / `Decisions`; drift from the contract is flagged so Claude Code can discount it.
|
|
88
88
|
- **Synthesis, not passthrough.** Raw model output never reaches you unless you ask for it; the provenance footer always does.
|
|
89
89
|
|
|
@@ -129,7 +129,7 @@ You have a question → /multi-consult → question + criteria → Codex, Gemi
|
|
|
129
129
|
| `claude.effort` / `claude.consultEffort` | `claude --effort` (`low`…`max`) for review / consult; `null` omits the flag. |
|
|
130
130
|
| `codex.reasoningEffort` / `codex.serviceTier` | Review defaults; the `consult*` keys are the consult defaults. Tool arguments override both. |
|
|
131
131
|
| `gemini.model` | Passed as `agy --model`; omit to use agy's own setting (`agy models` lists ids). |
|
|
132
|
-
| `*.inactivityTimeoutMs` | How long a reviewer may stay silent. Codex liveness is also proven via its rollout file; agy
|
|
132
|
+
| `*.inactivityTimeoutMs` | How long a reviewer may stay silent. Codex liveness is also proven via its rollout file; agy streams an event per model turn and tool call. agy's `--print-timeout` is set from `gemini.maxTimeoutMs`. |
|
|
133
133
|
|
|
134
134
|
`npx -y @simonren/quorum doctor` prints the detected CLIs, their versions, and the effective settings.
|
|
135
135
|
|
package/dist/adapters/claude.js
CHANGED
|
@@ -115,7 +115,9 @@ export class ClaudeAdapter extends CliAdapter {
|
|
|
115
115
|
// A completed response wins over a non-fatal error event that preceded it.
|
|
116
116
|
// `!== null` so an empty-string result reaches empty-response handling.
|
|
117
117
|
if (finalResponse !== null) {
|
|
118
|
-
|
|
118
|
+
// The stream also carries every tool result, so the executor's cap on raw
|
|
119
|
+
// stdout says nothing about whether the response is complete.
|
|
120
|
+
return { stdout: finalResponse, stderr: result.stderr, exitCode: 0, truncated: false };
|
|
119
121
|
}
|
|
120
122
|
if (decoderError) {
|
|
121
123
|
return { stdout: '', stderr: this.combineDiagnostics(decoderError, result.stderr), exitCode: 1, truncated: false };
|
package/dist/adapters/codex.js
CHANGED
|
@@ -113,7 +113,9 @@ export class CodexAdapter extends CliAdapter {
|
|
|
113
113
|
// `!== null` so an empty-string response reaches empty-response handling.
|
|
114
114
|
const finalResponse = decoder.getFinalResponse();
|
|
115
115
|
if (finalResponse !== null) {
|
|
116
|
-
|
|
116
|
+
// The JSONL stream also carries every command's output, so the executor's
|
|
117
|
+
// cap on raw stdout says nothing about whether the response is complete.
|
|
118
|
+
return { stdout: finalResponse, stderr: result.stderr, exitCode: result.exitCode, truncated: false };
|
|
117
119
|
}
|
|
118
120
|
const decoderError = decoder.getError();
|
|
119
121
|
if (decoderError) {
|
|
@@ -9,13 +9,28 @@
|
|
|
9
9
|
* - the prompt must be the positional after `--print` (stdin alone makes agy
|
|
10
10
|
* print --help and exit 0), so the prompt size is bounded by the OS argv
|
|
11
11
|
* limit — see MAX_ARGV_PROMPT_BYTES
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
12
|
+
* - `--output-format stream-json` emits an event per model turn and per tool
|
|
13
|
+
* call, so the inactivity timer only fires on a real stall. In text mode
|
|
14
|
+
* agy printed nothing until it finished, which made that timer a
|
|
15
|
+
* total-runtime cap: reviews of 100+ serial turns were killed at 15 minutes
|
|
16
|
+
* and all of their output was lost
|
|
17
|
+
* - agy's own `--print-timeout` ends the run as a SUCCESS with partial
|
|
18
|
+
* output, so it is set to the total cap; quorum's timer starts earlier and
|
|
19
|
+
* always fires first
|
|
14
20
|
* - `--sandbox` restricts the terminal only. agy's file tools CAN still write
|
|
15
21
|
* to the workspace (verified with `--sandbox` and with `--mode plan`), and
|
|
16
22
|
* agy has no read-only switch, so the tool handlers fingerprint the working
|
|
17
|
-
* tree before and after every run and flag any change (`integrity.ts`)
|
|
23
|
+
* tree before and after every run and flag any change (`integrity.ts`).
|
|
24
|
+
* The model can also ask to run a command outside the sandbox; agy grants
|
|
25
|
+
* that unasked when the user's `toolPermission` is `always-proceed`
|
|
26
|
+
* (`quorum doctor` warns), and denies it in print mode under
|
|
27
|
+
* `proceed-in-sandbox`
|
|
28
|
+
* - a failing git is what makes the model ask for that bypass: inside the
|
|
29
|
+
* sandbox git cannot read ~/.gitconfig, nor a git dir outside the
|
|
30
|
+
* workspace — see SANDBOX_GIT_ENV and gitDirOutside
|
|
18
31
|
* - `--add-dir` scopes reads; `--model` is optional (`gemini.model`)
|
|
32
|
+
* - agy names its log by the second a run starts, so the two parallel passes
|
|
33
|
+
* wrote one file; each run gets its own `--log-file`
|
|
19
34
|
* - every print run does a silent OAuth handshake (keyring token, a few round
|
|
20
35
|
* trips to cloudcode-pa.googleapis.com, then an eligibility check that
|
|
21
36
|
* fetches the profile picture from lh3.googleusercontent.com) before the
|
|
@@ -25,6 +40,19 @@
|
|
|
25
40
|
*/
|
|
26
41
|
import { ReviewerCapabilities } from './base.js';
|
|
27
42
|
import { CliAdapter, CliOutcome, RunContext, RunLimits } from './cli-adapter.js';
|
|
43
|
+
/**
|
|
44
|
+
* The terminal sandbox denies reads outside the workspace, so git dies on
|
|
45
|
+
* ~/.gitconfig and warns about ~/.config/git/ignore on every call. A review
|
|
46
|
+
* needs only the repository's own config.
|
|
47
|
+
*/
|
|
48
|
+
export declare const SANDBOX_GIT_ENV: Record<string, string>;
|
|
49
|
+
/**
|
|
50
|
+
* The repository's git dir when it lies outside `workingDir`: a worktree, whose
|
|
51
|
+
* `.git` file points into the main checkout, or a subdirectory of a repository.
|
|
52
|
+
* The sandbox can read it only as an extra `--add-dir`; without that every git
|
|
53
|
+
* command fails. Null outside a git repository.
|
|
54
|
+
*/
|
|
55
|
+
export declare function gitDirOutside(workingDir: string): string | null;
|
|
28
56
|
/**
|
|
29
57
|
* Linux caps a single argv string at 128 KiB (MAX_ARG_STRLEN); macOS caps the
|
|
30
58
|
* whole argv+env block. A prompt beyond this would make spawn fail with E2BIG,
|
package/dist/adapters/gemini.js
CHANGED
|
@@ -9,13 +9,28 @@
|
|
|
9
9
|
* - the prompt must be the positional after `--print` (stdin alone makes agy
|
|
10
10
|
* print --help and exit 0), so the prompt size is bounded by the OS argv
|
|
11
11
|
* limit — see MAX_ARGV_PROMPT_BYTES
|
|
12
|
-
* -
|
|
13
|
-
*
|
|
12
|
+
* - `--output-format stream-json` emits an event per model turn and per tool
|
|
13
|
+
* call, so the inactivity timer only fires on a real stall. In text mode
|
|
14
|
+
* agy printed nothing until it finished, which made that timer a
|
|
15
|
+
* total-runtime cap: reviews of 100+ serial turns were killed at 15 minutes
|
|
16
|
+
* and all of their output was lost
|
|
17
|
+
* - agy's own `--print-timeout` ends the run as a SUCCESS with partial
|
|
18
|
+
* output, so it is set to the total cap; quorum's timer starts earlier and
|
|
19
|
+
* always fires first
|
|
14
20
|
* - `--sandbox` restricts the terminal only. agy's file tools CAN still write
|
|
15
21
|
* to the workspace (verified with `--sandbox` and with `--mode plan`), and
|
|
16
22
|
* agy has no read-only switch, so the tool handlers fingerprint the working
|
|
17
|
-
* tree before and after every run and flag any change (`integrity.ts`)
|
|
23
|
+
* tree before and after every run and flag any change (`integrity.ts`).
|
|
24
|
+
* The model can also ask to run a command outside the sandbox; agy grants
|
|
25
|
+
* that unasked when the user's `toolPermission` is `always-proceed`
|
|
26
|
+
* (`quorum doctor` warns), and denies it in print mode under
|
|
27
|
+
* `proceed-in-sandbox`
|
|
28
|
+
* - a failing git is what makes the model ask for that bypass: inside the
|
|
29
|
+
* sandbox git cannot read ~/.gitconfig, nor a git dir outside the
|
|
30
|
+
* workspace — see SANDBOX_GIT_ENV and gitDirOutside
|
|
18
31
|
* - `--add-dir` scopes reads; `--model` is optional (`gemini.model`)
|
|
32
|
+
* - agy names its log by the second a run starts, so the two parallel passes
|
|
33
|
+
* wrote one file; each run gets its own `--log-file`
|
|
19
34
|
* - every print run does a silent OAuth handshake (keyring token, a few round
|
|
20
35
|
* trips to cloudcode-pa.googleapis.com, then an eligibility check that
|
|
21
36
|
* fetches the profile picture from lh3.googleusercontent.com) before the
|
|
@@ -23,18 +38,59 @@
|
|
|
23
38
|
* timed out" (~10s) or "Eligibility check failed … TLS handshake timeout"
|
|
24
39
|
* (~50s) even though the login is fine — see the retry below
|
|
25
40
|
*/
|
|
41
|
+
import { execFileSync } from 'child_process';
|
|
42
|
+
import { randomUUID } from 'crypto';
|
|
43
|
+
import { homedir } from 'os';
|
|
44
|
+
import { isAbsolute, join, relative, resolve, sep } from 'path';
|
|
26
45
|
import { registerAdapter } from './base.js';
|
|
27
46
|
import { CliAdapter } from './cli-adapter.js';
|
|
28
47
|
import { CliExecutor } from '../executor.js';
|
|
48
|
+
import { AgyEventDecoder } from '../decoders/index.js';
|
|
29
49
|
import { getConfig } from '../config.js';
|
|
30
50
|
const AGY_INSTALL_CMD = 'curl -fsSL https://antigravity.google/cli/install.sh | bash';
|
|
51
|
+
/**
|
|
52
|
+
* The terminal sandbox denies reads outside the workspace, so git dies on
|
|
53
|
+
* ~/.gitconfig and warns about ~/.config/git/ignore on every call. A review
|
|
54
|
+
* needs only the repository's own config.
|
|
55
|
+
*/
|
|
56
|
+
export const SANDBOX_GIT_ENV = {
|
|
57
|
+
GIT_CONFIG_GLOBAL: '/dev/null',
|
|
58
|
+
GIT_CONFIG_COUNT: '1',
|
|
59
|
+
GIT_CONFIG_KEY_0: 'core.excludesFile',
|
|
60
|
+
GIT_CONFIG_VALUE_0: '/dev/null',
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* The repository's git dir when it lies outside `workingDir`: a worktree, whose
|
|
64
|
+
* `.git` file points into the main checkout, or a subdirectory of a repository.
|
|
65
|
+
* The sandbox can read it only as an extra `--add-dir`; without that every git
|
|
66
|
+
* command fails. Null outside a git repository.
|
|
67
|
+
*/
|
|
68
|
+
export function gitDirOutside(workingDir) {
|
|
69
|
+
try {
|
|
70
|
+
const out = execFileSync('git', ['-C', workingDir, 'rev-parse', '--git-common-dir'], {
|
|
71
|
+
encoding: 'utf-8',
|
|
72
|
+
timeout: 15_000,
|
|
73
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
74
|
+
}).trim();
|
|
75
|
+
const dir = resolve(workingDir, out);
|
|
76
|
+
const rel = relative(workingDir, dir);
|
|
77
|
+
return rel === '..' || rel.startsWith(`..${sep}`) || isAbsolute(rel) ? dir : null;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function agyLogFile() {
|
|
84
|
+
const stamp = new Date().toISOString().replace(/[:.]/g, '-');
|
|
85
|
+
return join(homedir(), '.gemini', 'antigravity-cli', 'log', `cli-quorum-${stamp}-${randomUUID().slice(0, 8)}.log`);
|
|
86
|
+
}
|
|
31
87
|
/**
|
|
32
88
|
* Linux caps a single argv string at 128 KiB (MAX_ARG_STRLEN); macOS caps the
|
|
33
89
|
* whole argv+env block. A prompt beyond this would make spawn fail with E2BIG,
|
|
34
90
|
* so refuse early with a message that says what to shrink.
|
|
35
91
|
*/
|
|
36
92
|
export const MAX_ARGV_PROMPT_BYTES = 120_000;
|
|
37
|
-
/**
|
|
93
|
+
/** Diagnostics of an agy run that died in the pre-prompt handshake. */
|
|
38
94
|
const AUTH_HANDSHAKE_FAILURE = /authentication (?:failed or timed out|required)|eligibility check failed/i;
|
|
39
95
|
/**
|
|
40
96
|
* A handshake failure surfaces within ~60s (startup, the ~10s auth deadline,
|
|
@@ -77,39 +133,54 @@ export class GeminiAdapter extends CliAdapter {
|
|
|
77
133
|
truncated: false,
|
|
78
134
|
};
|
|
79
135
|
}
|
|
80
|
-
const
|
|
136
|
+
const gitDir = gitDirOutside(workingDir);
|
|
137
|
+
const args = (logFile) => [
|
|
81
138
|
...(cfg.model ? ['--model', cfg.model] : []),
|
|
82
|
-
|
|
83
|
-
//
|
|
84
|
-
'
|
|
139
|
+
'--output-format', 'stream-json',
|
|
140
|
+
// Go duration syntax. Matches the total cap rather than the inactivity
|
|
141
|
+
// timer: agy's clock starts after quorum's, so quorum's fires first.
|
|
142
|
+
'--print-timeout', `${Math.ceil(limits.maxTimeoutMs / 1000)}s`,
|
|
85
143
|
'--sandbox',
|
|
86
144
|
'--add-dir', workingDir,
|
|
145
|
+
...(gitDir ? ['--add-dir', gitDir] : []),
|
|
146
|
+
'--log-file', logFile,
|
|
87
147
|
'--print', prompt,
|
|
88
148
|
];
|
|
89
149
|
const cliStartTime = Date.now();
|
|
90
150
|
const seconds = () => Math.round((Date.now() - cliStartTime) / 1000);
|
|
91
151
|
console.error(`[gemini] Running ${ctx.kind} via agy${cfg.model ? ` (${cfg.model})` : ''}...`);
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
152
|
+
let steps = 0;
|
|
153
|
+
const runOnce = async () => {
|
|
154
|
+
const decoder = new AgyEventDecoder();
|
|
155
|
+
const result = await new CliExecutor({
|
|
156
|
+
command: this.binary,
|
|
157
|
+
args: args(agyLogFile()),
|
|
158
|
+
cwd: workingDir,
|
|
159
|
+
env: SANDBOX_GIT_ENV,
|
|
160
|
+
inactivityTimeoutMs: limits.inactivityTimeoutMs,
|
|
161
|
+
maxTimeoutMs: limits.maxTimeoutMs,
|
|
162
|
+
maxBufferSize: limits.maxBufferSize,
|
|
163
|
+
onLine: (line) => decoder.processLine(line),
|
|
164
|
+
}).run();
|
|
165
|
+
steps += decoder.getStepCount();
|
|
166
|
+
const final = decoder.getResult();
|
|
167
|
+
if (result.exitCode === 0 && final?.status === 'SUCCESS') {
|
|
168
|
+
// The stream also carries every tool output, so the executor's cap on
|
|
169
|
+
// raw stdout says nothing about whether the response is complete.
|
|
170
|
+
return { stdout: final.response, stderr: result.stderr, exitCode: 0, truncated: false };
|
|
171
|
+
}
|
|
172
|
+
const reason = final?.error
|
|
173
|
+
|| (final ? `agy ended with status ${final.status} (exit ${result.exitCode})` : `No result event from agy (exit ${result.exitCode})`);
|
|
174
|
+
return { stdout: '', stderr: this.combineDiagnostics(reason, result.stderr), exitCode: result.exitCode || 1, truncated: false };
|
|
175
|
+
};
|
|
176
|
+
let outcome = await runOnce();
|
|
177
|
+
if (outcome.exitCode !== 0 && Date.now() - cliStartTime < AUTH_RETRY_WINDOW_MS && AUTH_HANDSHAKE_FAILURE.test(outcome.stderr)) {
|
|
102
178
|
// The handshake is transient (slow network to Google), one retry usually lands.
|
|
103
179
|
console.error(`[gemini] agy auth handshake failed after ${seconds()}s; retrying once`);
|
|
104
|
-
|
|
180
|
+
outcome = await runOnce();
|
|
105
181
|
}
|
|
106
|
-
console.error(`[gemini] ✓ complete (${seconds()}s)`);
|
|
107
|
-
return
|
|
108
|
-
stdout: result.rawStdout,
|
|
109
|
-
stderr: result.stderr,
|
|
110
|
-
exitCode: result.exitCode,
|
|
111
|
-
truncated: result.truncated,
|
|
112
|
-
};
|
|
182
|
+
console.error(`[gemini] ✓ complete (${seconds()}s, ${steps} steps)`);
|
|
183
|
+
return outcome;
|
|
113
184
|
}
|
|
114
185
|
}
|
|
115
186
|
export const geminiAdapter = new GeminiAdapter();
|
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>;
|
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
|
})
|
|
@@ -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,6 +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[];
|
|
19
27
|
export declare function checkCodexHostConfig(configPath?: string): string[];
|
|
20
28
|
/** `quorum doctor`: full report on stdout. Returns the process exit code. */
|
|
21
29
|
export declare function runDoctor(version: string): Promise<number>;
|
package/dist/doctor.js
CHANGED
|
@@ -67,6 +67,29 @@ export async function logCliStatus() {
|
|
|
67
67
|
}
|
|
68
68
|
for (const w of checkCodexHostConfig())
|
|
69
69
|
console.error(`[quorum] Warning: ${w}`);
|
|
70
|
+
for (const w of agyWarnings())
|
|
71
|
+
console.error(`[quorum] Warning: ${w}`);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* agy's `toolPermission: always-proceed` approves the model's own requests to
|
|
75
|
+
* run a command outside the terminal sandbox, so `--sandbox` stops nothing.
|
|
76
|
+
* Under `proceed-in-sandbox` sandboxed commands still run unasked and print
|
|
77
|
+
* mode denies the bypass. agy has no per-run flag for this, so it is the
|
|
78
|
+
* user's setting to change.
|
|
79
|
+
*/
|
|
80
|
+
export function checkAgyToolPermission(settingsPath = join(homedir(), '.gemini', 'antigravity-cli', 'settings.json')) {
|
|
81
|
+
try {
|
|
82
|
+
const { toolPermission } = JSON.parse(readFileSync(settingsPath, 'utf-8'));
|
|
83
|
+
if (toolPermission !== 'always-proceed')
|
|
84
|
+
return [];
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
return [`${settingsPath}: toolPermission is "always-proceed", so agy lets the Gemini reviewer run commands outside --sandbox without asking. Set it to "proceed-in-sandbox".`];
|
|
90
|
+
}
|
|
91
|
+
function agyWarnings() {
|
|
92
|
+
return getConfig().gemini.enabled ? checkAgyToolPermission() : [];
|
|
70
93
|
}
|
|
71
94
|
/**
|
|
72
95
|
* Codex kills an MCP tool call at `tool_timeout_sec` (default 60) and gives up
|
|
@@ -163,6 +186,13 @@ export async function runDoctor(version) {
|
|
|
163
186
|
for (const w of hostWarnings)
|
|
164
187
|
console.log(` ⚠️ ${w}`);
|
|
165
188
|
}
|
|
189
|
+
const geminiWarnings = agyWarnings();
|
|
190
|
+
if (geminiWarnings.length > 0) {
|
|
191
|
+
console.log('');
|
|
192
|
+
console.log('Gemini (agy):');
|
|
193
|
+
for (const w of geminiWarnings)
|
|
194
|
+
console.log(` ⚠️ ${w}`);
|
|
195
|
+
}
|
|
166
196
|
const usable = statuses.filter((s) => s.enabled && s.available);
|
|
167
197
|
console.log('');
|
|
168
198
|
if (usable.length === 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simonren/quorum",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "MCP server for Claude Code — a quorum of AI models (Codex, Gemini, Claude Fable with fresh context) for standard + adversarial review and consultation, synthesized by Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|