@brutalist/mcp 1.13.0 → 1.14.2
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 +57 -31
- package/dist/brutalist-server.js +9 -9
- package/dist/brutalist-server.js.map +1 -1
- package/dist/cli-adapters/agy-adapter.d.ts +30 -0
- package/dist/cli-adapters/agy-adapter.d.ts.map +1 -0
- package/dist/cli-adapters/agy-adapter.js +312 -0
- package/dist/cli-adapters/agy-adapter.js.map +1 -0
- package/dist/cli-adapters/index.d.ts +8 -12
- package/dist/cli-adapters/index.d.ts.map +1 -1
- package/dist/cli-adapters/index.js +2 -2
- package/dist/cli-adapters/index.js.map +1 -1
- package/dist/cli-agents.d.ts +6 -29
- package/dist/cli-agents.d.ts.map +1 -1
- package/dist/cli-agents.js +30 -129
- package/dist/cli-agents.js.map +1 -1
- package/dist/debate/debate-orchestrator.d.ts +2 -4
- package/dist/debate/debate-orchestrator.d.ts.map +1 -1
- package/dist/debate/debate-orchestrator.js.map +1 -1
- package/dist/domains/argument-space.d.ts +8 -8
- package/dist/domains/argument-space.js +3 -3
- package/dist/domains/argument-space.js.map +1 -1
- package/dist/domains/critic-persona.d.ts +2 -1
- package/dist/domains/critic-persona.d.ts.map +1 -1
- package/dist/domains/critic-persona.js.map +1 -1
- package/dist/handlers/tool-handler.js.map +1 -1
- package/dist/mcp-registry.d.ts +0 -6
- package/dist/mcp-registry.d.ts.map +1 -1
- package/dist/mcp-registry.js +0 -35
- package/dist/mcp-registry.js.map +1 -1
- package/dist/metrics/registry.d.ts +2 -2
- package/dist/metrics/registry.js +2 -2
- package/dist/metrics/types.d.ts +1 -1
- package/dist/metrics/types.js +1 -1
- package/dist/model-resolver.d.ts +1 -13
- package/dist/model-resolver.d.ts.map +1 -1
- package/dist/model-resolver.js +12 -7
- package/dist/model-resolver.js.map +1 -1
- package/dist/streaming/output-parser.d.ts +1 -1
- package/dist/streaming/output-parser.d.ts.map +1 -1
- package/dist/streaming/output-parser.js +0 -17
- package/dist/streaming/output-parser.js.map +1 -1
- package/dist/streaming/streaming-orchestrator.js +1 -1
- package/dist/streaming/streaming-orchestrator.js.map +1 -1
- package/dist/types/brutalist.d.ts +3 -3
- package/dist/types/brutalist.d.ts.map +1 -1
- package/dist/types/tool-config.d.ts +4 -4
- package/dist/types/tool-config.d.ts.map +1 -1
- package/dist/types/tool-config.js +7 -6
- package/dist/types/tool-config.js.map +1 -1
- package/package.json +4 -3
- package/dist/cli-adapters/gemini-adapter.d.ts +0 -84
- package/dist/cli-adapters/gemini-adapter.d.ts.map +0 -1
- package/dist/cli-adapters/gemini-adapter.js +0 -305
- package/dist/cli-adapters/gemini-adapter.js.map +0 -1
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agy (Google Antigravity) CLI Adapter
|
|
3
|
+
*
|
|
4
|
+
* Encapsulates Antigravity-specific CLI invocation. agy is the gemini-cli
|
|
5
|
+
* successor for the Pro/Ultra/free Google AI tier. See
|
|
6
|
+
* [[reference-agy-affordances-full]] for the full surface map; the key
|
|
7
|
+
* constraints we engineer around here:
|
|
8
|
+
*
|
|
9
|
+
* - agy --print does NOT accept stdin; prompt goes via argv (~128KB
|
|
10
|
+
* ARG_MAX cap). Brutalist's actual prompts are well under that.
|
|
11
|
+
* - No --model flag exists at runtime ("--model" is a dead string in
|
|
12
|
+
* the binary, rejected by the Go flag parser). agy --print is hard-
|
|
13
|
+
* pinned to whatever is in `~/.gemini/antigravity-cli/settings.json`
|
|
14
|
+
* under the `model` key — and only the HUMAN-READABLE label form
|
|
15
|
+
* ("Gemini 3.1 Pro (High)", not "gemini-3-pro-preview"). When the
|
|
16
|
+
* caller passes `options.models.agy`, the Python wrapper swaps that
|
|
17
|
+
* value into settings.json under flock(2), runs agy, restores the
|
|
18
|
+
* original. Race-safe across processes that share $HOME. Default
|
|
19
|
+
* (no override) leaves settings.json untouched and agy uses whatever
|
|
20
|
+
* model the user picked via the TUI's /model command, falling back
|
|
21
|
+
* to "Gemini 3.5 Flash (Medium)" if unset.
|
|
22
|
+
* - No --system flag either. The adversarial prompt is composed into
|
|
23
|
+
* the user-prompt slot via the promptWrapper-style folding below.
|
|
24
|
+
* - --print-timeout is internally broken (e.g. `=3s` runs until
|
|
25
|
+
* external kill). The orchestrator's spawnAsync timeout is the real
|
|
26
|
+
* wall-clock enforcement; we still pass --print-timeout 15m as an
|
|
27
|
+
* internal hint so agy's own polling loop doesn't accidentally
|
|
28
|
+
* short-circuit.
|
|
29
|
+
* - --sandbox redirects writes to ~/.gemini/antigravity-cli/scratch/
|
|
30
|
+
* instead of writing into the caller's cwd, so agy's agentic loop
|
|
31
|
+
* can call tools (creating implementation_plan.md, etc.) without
|
|
32
|
+
* polluting the user's repo.
|
|
33
|
+
* - --dangerously-skip-permissions auto-approves tool permission
|
|
34
|
+
* prompts — there's no human in --print mode to answer them, so
|
|
35
|
+
* skipping is the only path forward.
|
|
36
|
+
*
|
|
37
|
+
* Auth (not adapter-side): on macOS the user authenticates once with
|
|
38
|
+
* `agy "hi"` interactively (keychain seeded). In CI runners, the
|
|
39
|
+
* GitHub Action provisions ~/.gemini/antigravity-cli/antigravity-oauth-token
|
|
40
|
+
* from a repo secret before brutalist invokes us. Container detection in
|
|
41
|
+
* agy auto-fires (cgroup-based, see affordance map) and switches to the
|
|
42
|
+
* file-token-storage path on its own — no env var needed on our side.
|
|
43
|
+
*/
|
|
44
|
+
import { existsSync } from 'node:fs';
|
|
45
|
+
import { homedir } from 'node:os';
|
|
46
|
+
import path from 'node:path';
|
|
47
|
+
import { logger as rootLogger } from '../logger.js';
|
|
48
|
+
/**
|
|
49
|
+
* Resolve which binary to invoke as `agy`. Three-step priority:
|
|
50
|
+
*
|
|
51
|
+
* 1. `AGY_BIN` env var (explicit user override). Wins unconditionally.
|
|
52
|
+
* 2. `~/.local/bin/agy` (canonical CLI-agent install path per
|
|
53
|
+
* `curl ... antigravity.google/cli/install.sh | bash`). Preferred
|
|
54
|
+
* because on macOS the Antigravity desktop IDE installs a wrapper
|
|
55
|
+
* at `~/.antigravity/antigravity/bin/agy` that is a SYMLINK into
|
|
56
|
+
* the .app bundle (an Electron/VS Code fork — NOT the Go CLI
|
|
57
|
+
* agent). That wrapper resolves first on PATH for many users
|
|
58
|
+
* because the IDE's installer prepends its bin dir. Bypassing
|
|
59
|
+
* PATH for the canonical location avoids invoking the IDE binary
|
|
60
|
+
* with the agent CLI's flags (`--print`, etc.) — which the IDE
|
|
61
|
+
* politely passes through to Electron with warnings rather than
|
|
62
|
+
* running as the agent.
|
|
63
|
+
* 3. Bare `'agy'` (PATH lookup). Last-resort for non-standard
|
|
64
|
+
* installs.
|
|
65
|
+
*
|
|
66
|
+
* Resolved at module load — the user's environment shouldn't change
|
|
67
|
+
* mid-process, and the MCP server is restarted when paths change.
|
|
68
|
+
*/
|
|
69
|
+
function resolveAgyBin() {
|
|
70
|
+
if (process.env.AGY_BIN)
|
|
71
|
+
return process.env.AGY_BIN;
|
|
72
|
+
const homeLocal = path.join(homedir(), '.local', 'bin', 'agy');
|
|
73
|
+
if (existsSync(homeLocal))
|
|
74
|
+
return homeLocal;
|
|
75
|
+
return 'agy';
|
|
76
|
+
}
|
|
77
|
+
export const AGY_BINARY = resolveAgyBin();
|
|
78
|
+
/**
|
|
79
|
+
* Inline Python wrapper. Handles two concerns:
|
|
80
|
+
*
|
|
81
|
+
* (a) PTY allocation. agy issue #76 (stdout silently dropped when
|
|
82
|
+
* stdout is not a TTY) hits macOS and Windows but NOT Linux.
|
|
83
|
+
* The wrapper creates a pty pair, forks, child sees the slave TTY
|
|
84
|
+
* (bypassing agy's isatty check), parent reads from the master and
|
|
85
|
+
* writes to its own stdout (which can be a pipe — that part works
|
|
86
|
+
* regardless of #76).
|
|
87
|
+
*
|
|
88
|
+
* (b) Per-invocation model pinning via settings.json. agy has no
|
|
89
|
+
* --model flag at runtime, but `settings.json.model` accepts the
|
|
90
|
+
* human-readable label form ("Gemini 3.1 Pro (High)", etc.) and
|
|
91
|
+
* agy's `model_config_manager.go:157` log confirms it propagates
|
|
92
|
+
* the label to the backend. The wrapper reads BRUTALIST_AGY_MODEL_PIN
|
|
93
|
+
* from env; if set, it acquires an fcntl.flock(LOCK_EX) on a
|
|
94
|
+
* sibling lockfile, reads + backs up the existing settings.json,
|
|
95
|
+
* writes the merged version with the model override, spawns agy,
|
|
96
|
+
* and restores the original settings.json on exit (in a finally
|
|
97
|
+
* block so SIGTERM/exception paths still clean up). Race-safe
|
|
98
|
+
* across processes that share $HOME.
|
|
99
|
+
*
|
|
100
|
+
* Why Python and not node-pty:
|
|
101
|
+
* - node-pty is a native module: prebuilt binaries per platform,
|
|
102
|
+
* `spawn-helper` chmod gotchas during npm install, install-time
|
|
103
|
+
* failure modes on unusual setups (Apple Silicon Node 24 had
|
|
104
|
+
* intermittent issues this session). Adds 140KB of native code
|
|
105
|
+
* to the dep tree.
|
|
106
|
+
* - Python 3 is preinstalled on macOS (12+ ships /usr/bin/python3
|
|
107
|
+
* stub that triggers Xcode CLT install on first run; users
|
|
108
|
+
* running agy locally already have CLT for `agy` itself to
|
|
109
|
+
* install). And on Linux runners (Ubuntu LTS) by default.
|
|
110
|
+
* - `pty.spawn` and `fcntl.flock` are stdlib. Zero install cost.
|
|
111
|
+
*
|
|
112
|
+
* Supported `BRUTALIST_AGY_MODEL_PIN` label values (per Antigravity
|
|
113
|
+
* docs + binary strings; per-account entitlement gates Pro/Claude):
|
|
114
|
+
* - "Gemini 3.5 Flash (High|Medium)" — always available
|
|
115
|
+
* - "Gemini 3.1 Pro (High|Low)" — Pro tier
|
|
116
|
+
* - "Claude Sonnet 4.6 (Thinking)" — Antigravity Claude tier
|
|
117
|
+
* - "Claude Opus 4.6 (Thinking)" — Antigravity Claude tier
|
|
118
|
+
* - "GPT-OSS 120B (Medium)" — Antigravity tier
|
|
119
|
+
* Invalid labels are silently downselected by agy to Flash Medium.
|
|
120
|
+
*/
|
|
121
|
+
const AGY_PYTHON_WRAPPER = `
|
|
122
|
+
import pty, sys, os, json, fcntl
|
|
123
|
+
agy_bin, agy_args = sys.argv[1], sys.argv[2:]
|
|
124
|
+
model = os.environ.get('BRUTALIST_AGY_MODEL_PIN', '').strip()
|
|
125
|
+
home = os.path.expanduser('~')
|
|
126
|
+
settings = os.path.join(home, '.gemini', 'antigravity-cli', 'settings.json')
|
|
127
|
+
lock_path = settings + '.brutalist-lock'
|
|
128
|
+
original = None
|
|
129
|
+
lock_fd = None
|
|
130
|
+
if model:
|
|
131
|
+
os.makedirs(os.path.dirname(settings), exist_ok=True)
|
|
132
|
+
lock_fd = os.open(lock_path, os.O_CREAT | os.O_RDWR, 0o600)
|
|
133
|
+
fcntl.flock(lock_fd, fcntl.LOCK_EX)
|
|
134
|
+
try:
|
|
135
|
+
with open(settings, 'r') as f:
|
|
136
|
+
original = f.read()
|
|
137
|
+
cfg = json.loads(original) if original.strip() else {}
|
|
138
|
+
except FileNotFoundError:
|
|
139
|
+
cfg = {}
|
|
140
|
+
cfg['model'] = model
|
|
141
|
+
with open(settings, 'w') as f:
|
|
142
|
+
json.dump(cfg, f)
|
|
143
|
+
try:
|
|
144
|
+
status = pty.spawn([agy_bin] + agy_args)
|
|
145
|
+
finally:
|
|
146
|
+
if model:
|
|
147
|
+
try:
|
|
148
|
+
if original is None:
|
|
149
|
+
try: os.unlink(settings)
|
|
150
|
+
except FileNotFoundError: pass
|
|
151
|
+
else:
|
|
152
|
+
with open(settings, 'w') as f:
|
|
153
|
+
f.write(original)
|
|
154
|
+
finally:
|
|
155
|
+
if lock_fd is not None:
|
|
156
|
+
fcntl.flock(lock_fd, fcntl.LOCK_UN)
|
|
157
|
+
os.close(lock_fd)
|
|
158
|
+
sys.exit(os.waitstatus_to_exitcode(status))
|
|
159
|
+
`.trim();
|
|
160
|
+
const PTY_WRAP_NEEDED = process.platform === 'darwin' || process.platform === 'win32';
|
|
161
|
+
const AGY_CONFIG = {
|
|
162
|
+
// Routing is decided per-invocation in buildCommand() based on
|
|
163
|
+
// (a) platform needing PTY and (b) whether a model pin is requested.
|
|
164
|
+
// This static config slot is just the default for the spawn entrypoint.
|
|
165
|
+
command: AGY_BINARY,
|
|
166
|
+
defaultArgs: ['--print'],
|
|
167
|
+
// No --model flag exists; this slot is unused for agy. Kept for
|
|
168
|
+
// CLIBuilderConfig conformance.
|
|
169
|
+
modelArgName: '',
|
|
170
|
+
};
|
|
171
|
+
// Default model when nothing's pinned. agy reads settings.json at
|
|
172
|
+
// startup; if the user previously chose a model via TUI's /model
|
|
173
|
+
// command, that value is what runs. Without any settings.json model
|
|
174
|
+
// key, the runtime default is Flash Medium.
|
|
175
|
+
const AGY_DEFAULT_MODEL = 'Gemini 3.5 Flash (Medium)';
|
|
176
|
+
// Refusal signals. agy bakes auth and quota outcomes into stdout (not
|
|
177
|
+
// stderr), exit code 0, with anchored prefixes we can match without
|
|
178
|
+
// pulling in prose-as-signal antipatterns. See affordance map § Output
|
|
179
|
+
// channels and § Known broken / quirky for the empirical confirmation.
|
|
180
|
+
//
|
|
181
|
+
// "Authentication required. Please visit the URL to log in: <url>"
|
|
182
|
+
// "⚠ Individual quota reached. Contact your administrator to enable
|
|
183
|
+
// overages. Resets in <Nh><Nm><Ns>."
|
|
184
|
+
const AUTH_REFUSAL_RE = /^Authentication required\./m;
|
|
185
|
+
const QUOTA_REFUSAL_RE = /^\s*⚠\s*Individual quota reached/m;
|
|
186
|
+
export class AgyAdapter {
|
|
187
|
+
name = 'agy';
|
|
188
|
+
getConfig() {
|
|
189
|
+
return AGY_CONFIG;
|
|
190
|
+
}
|
|
191
|
+
async buildCommand(userPrompt, systemPrompt, options, _modelResolver, secureEnv) {
|
|
192
|
+
const log = options.log ?? rootLogger;
|
|
193
|
+
// Fold the adversarial system prompt into the user prompt slot.
|
|
194
|
+
// agy has no --system / --append-system-prompt equivalent
|
|
195
|
+
// (verified — rejected by the Go flag parser). Strong-position
|
|
196
|
+
// composition: directives first, then a separator, then the user
|
|
197
|
+
// content. The model treats this as the user's instructions.
|
|
198
|
+
//
|
|
199
|
+
// Agy-specific orientation (claude/codex do NOT need this — they stay
|
|
200
|
+
// focused on their own). agy is an agentic loop, not a completion API:
|
|
201
|
+
// pointed at a repo with "Analyze the codebase directory at <path>" it
|
|
202
|
+
// (a) wanders the filesystem hunting for "where the code is" —
|
|
203
|
+
// worsened by --sandbox redirecting its cwd sense to the scratch
|
|
204
|
+
// dir, so it lists scratch/$HOME/config dirs before finding the
|
|
205
|
+
// target; and
|
|
206
|
+
// (b) takes "the codebase directory" literally and tries to review
|
|
207
|
+
// the WHOLE repo, never converging inside the orchestrator's
|
|
208
|
+
// wall-clock budget on a real codebase.
|
|
209
|
+
// The combination stalled out a 30-min PR-review budget on a 30-line
|
|
210
|
+
// diff. When a unified diff is present (the PR-review path) we prepend
|
|
211
|
+
// an orientation that anchors agy to the absolute target, scopes it to
|
|
212
|
+
// the changed files, and frames the task as a defensive pre-merge
|
|
213
|
+
// review (Gemini Flash otherwise intermittently refuses bare
|
|
214
|
+
// "find the vulnerability" prompts). Empirically: 30-min stall →
|
|
215
|
+
// ~15-50s focused, line-cited review. Gated on hasDiff so abstract
|
|
216
|
+
// roasts (idea/research/etc., where the content is inline and there's
|
|
217
|
+
// no filesystem target) are untouched.
|
|
218
|
+
const target = options.workingDirectory && path.isAbsolute(options.workingDirectory)
|
|
219
|
+
? options.workingDirectory
|
|
220
|
+
: undefined;
|
|
221
|
+
// constructUserPrompt embeds the diff as "Context: diff --git ..." so
|
|
222
|
+
// the `diff --git` marker is mid-line; match it anywhere. The `@@` hunk
|
|
223
|
+
// header is a second, line-anchored signal. A false negative (missing a
|
|
224
|
+
// diff) is worse than a false positive here, so cast wide.
|
|
225
|
+
const hasDiff = /diff --git /.test(userPrompt) || /(^|\n)@@ .+ @@/.test(userPrompt);
|
|
226
|
+
const orientation = hasDiff
|
|
227
|
+
? `You are performing a defensive pre-merge code review: your job is to help the author find and fix problems in this change before it is merged. Give your complete critique in one response, then stop. ${target ? `The code under review is in the repository at the absolute path: ${target} — read the relevant files there directly for context. ` : ''}Do not search elsewhere on the system (for example /tmp listings, your home directory, or any sandbox/scratch directory) to locate the code. A unified diff is included in the task below; even though the task may say "analyze the codebase directory", scope your review to the file(s) the diff changes rather than surveying the entire repository.`
|
|
228
|
+
: undefined;
|
|
229
|
+
const taskBlock = orientation ? `${orientation}\n\n${userPrompt}` : userPrompt;
|
|
230
|
+
const combinedPrompt = systemPrompt
|
|
231
|
+
? `${systemPrompt}\n\n---\n\n${taskBlock}`
|
|
232
|
+
: taskBlock;
|
|
233
|
+
// Soft-warn at 100KB; hard ARG_MAX is ~128KB on Linux. Brutalist's
|
|
234
|
+
// own prompts (system + code excerpt) typically run 5-30KB.
|
|
235
|
+
if (combinedPrompt.length > 100_000) {
|
|
236
|
+
log.warn('Agy prompt approaching argv ARG_MAX', {
|
|
237
|
+
promptBytes: combinedPrompt.length,
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
const agyArgs = [
|
|
241
|
+
'--print',
|
|
242
|
+
combinedPrompt,
|
|
243
|
+
// Internal polling hint; orchestrator's spawnAsync timeout
|
|
244
|
+
// (CLIAgentOptions.timeout) is what actually bounds wall-clock.
|
|
245
|
+
// 15m is comfortably above brutalist's per-CLI default but well
|
|
246
|
+
// below pathological-stall protection.
|
|
247
|
+
'--print-timeout', '15m',
|
|
248
|
+
// Containment: writes go to ~/.gemini/antigravity-cli/scratch/
|
|
249
|
+
// instead of cwd. Reads from cwd still work, so agy can inspect
|
|
250
|
+
// the user's codebase for the critique.
|
|
251
|
+
'--sandbox',
|
|
252
|
+
// No-prompts-allowed mode: auto-approve any permission requests
|
|
253
|
+
// since --print has no human to answer them. Required for
|
|
254
|
+
// autonomous critic execution.
|
|
255
|
+
'--dangerously-skip-permissions',
|
|
256
|
+
];
|
|
257
|
+
const modelPin = options.models?.agy?.trim();
|
|
258
|
+
// The Python wrapper handles two distinct concerns: PTY allocation
|
|
259
|
+
// for #76 on macOS/Windows, and settings.json swap+restore under
|
|
260
|
+
// flock(2) when a model pin is requested. We invoke it when EITHER
|
|
261
|
+
// is needed. On Linux without a model pin, agy runs directly.
|
|
262
|
+
const useWrapper = PTY_WRAP_NEEDED || !!modelPin;
|
|
263
|
+
const command = useWrapper ? 'python3' : AGY_BINARY;
|
|
264
|
+
const args = useWrapper
|
|
265
|
+
? ['-c', AGY_PYTHON_WRAPPER, AGY_BINARY, ...agyArgs]
|
|
266
|
+
: agyArgs;
|
|
267
|
+
const env = { ...secureEnv };
|
|
268
|
+
if (modelPin) {
|
|
269
|
+
env.BRUTALIST_AGY_MODEL_PIN = modelPin;
|
|
270
|
+
log.info('Agy model pin requested', { model: modelPin });
|
|
271
|
+
}
|
|
272
|
+
return {
|
|
273
|
+
command,
|
|
274
|
+
args,
|
|
275
|
+
// --print does not consume stdin; prompt is in argv.
|
|
276
|
+
input: '',
|
|
277
|
+
env,
|
|
278
|
+
model: modelPin || AGY_DEFAULT_MODEL,
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Decode raw agy stdout into a structured outcome.
|
|
283
|
+
*
|
|
284
|
+
* agy stdout in --print mode is clean text/Markdown with 0 ANSI
|
|
285
|
+
* escape bytes (verified empirically). Refusals are baked into the
|
|
286
|
+
* stdout stream with anchored prefixes — we match those without
|
|
287
|
+
* grepping the full text for loose patterns (which would re-introduce
|
|
288
|
+
* the prose-as-signal antipattern that commit 086a38f explicitly
|
|
289
|
+
* removed for claude/codex).
|
|
290
|
+
*/
|
|
291
|
+
decode(stdout, _stderr, _args, log) {
|
|
292
|
+
const decodeLog = log ?? rootLogger;
|
|
293
|
+
if (!stdout || !stdout.trim()) {
|
|
294
|
+
decodeLog.debug('agy: empty stdout');
|
|
295
|
+
return { kind: 'error', reason: 'empty' };
|
|
296
|
+
}
|
|
297
|
+
if (AUTH_REFUSAL_RE.test(stdout)) {
|
|
298
|
+
decodeLog.warn('agy: auth refusal detected in stdout');
|
|
299
|
+
return { kind: 'refused', reason: 'auth' };
|
|
300
|
+
}
|
|
301
|
+
if (QUOTA_REFUSAL_RE.test(stdout)) {
|
|
302
|
+
decodeLog.warn('agy: quota refusal detected in stdout');
|
|
303
|
+
return { kind: 'refused', reason: 'quota' };
|
|
304
|
+
}
|
|
305
|
+
return { kind: 'ok', text: stdout };
|
|
306
|
+
}
|
|
307
|
+
decodeOutput(rawOutput, args, log) {
|
|
308
|
+
const result = this.decode(rawOutput, '', args, log);
|
|
309
|
+
return result.kind === 'ok' ? result.text : '';
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=agy-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agy-adapter.js","sourceRoot":"","sources":["../../src/cli-adapters/agy-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AAMpD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,aAAa;IACpB,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO;QAAE,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;IACpD,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC/D,IAAI,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,SAAS,CAAC;IAC5C,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,EAAE,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,kBAAkB,GAAG;;;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CAAC,CAAC;YACvD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAC7C,CAAC;QAED,IAAI,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YAClC,SAAS,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;YACxD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;QAC9C,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACtC,CAAC;IAED,YAAY,CACV,SAAiB,EACjB,IAAc,EACd,GAAsB;QAEtB,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACrD,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACjD,CAAC;CACF"}
|
|
@@ -8,17 +8,16 @@ import type { CLIAgentOptions } from '../cli-agents.js';
|
|
|
8
8
|
import type { ModelResolver } from '../model-resolver.js';
|
|
9
9
|
import type { StructuredLogger } from '../logger.js';
|
|
10
10
|
export { parseNDJSON } from './shared.js';
|
|
11
|
-
export type CLIName = 'claude' | 'codex' | '
|
|
11
|
+
export type CLIName = 'claude' | 'codex' | 'agy';
|
|
12
12
|
export interface MCPSupportConfig {
|
|
13
13
|
/** How this CLI receives MCP server configuration */
|
|
14
|
-
configMethod: 'flag-file' | 'config-override'
|
|
14
|
+
configMethod: 'flag-file' | 'config-override';
|
|
15
15
|
configFlag?: string;
|
|
16
16
|
strictFlag?: string;
|
|
17
17
|
configOverrideKey?: string;
|
|
18
|
-
whitelistFlag?: string;
|
|
19
18
|
/** Hard write-prevention mechanism native to this CLI */
|
|
20
19
|
writeProtection: {
|
|
21
|
-
method: 'disallowed-tools' | 'sandbox'
|
|
20
|
+
method: 'disallowed-tools' | 'sandbox';
|
|
22
21
|
flag: string;
|
|
23
22
|
value: string;
|
|
24
23
|
};
|
|
@@ -44,9 +43,8 @@ export interface CLIBuilderConfig {
|
|
|
44
43
|
* class (see Phase 1 fix in cli-agents.ts).
|
|
45
44
|
*
|
|
46
45
|
* Each provider adapter populates this from its own protocol-level
|
|
47
|
-
* signals (Claude: `result.subtype` / `is_error`; Codex: error events
|
|
48
|
-
*
|
|
49
|
-
* assistant prose to classify refusals.
|
|
46
|
+
* signals (Claude: `result.subtype` / `is_error`; Codex: error events).
|
|
47
|
+
* The orchestrator never inspects assistant prose to classify refusals.
|
|
50
48
|
*/
|
|
51
49
|
export type DecodeRefusalReason = 'quota' | 'auth' | 'policy';
|
|
52
50
|
export type DecodeErrorReason = 'malformed' | 'empty' | 'unknown';
|
|
@@ -84,16 +82,14 @@ export interface CLIProvider {
|
|
|
84
82
|
* Each adapter inspects ITS OWN protocol-level signals to classify the
|
|
85
83
|
* run — refusal markers must come from the CLI's structured error
|
|
86
84
|
* channel (stream-json `result` events for Claude, error items for
|
|
87
|
-
* Codex
|
|
88
|
-
* assistant text the CLI returned.
|
|
85
|
+
* Codex) and never from the assistant text the CLI returned.
|
|
89
86
|
*
|
|
90
87
|
* The orchestrator consumes `DecodeResult.kind` directly; no caller
|
|
91
88
|
* grep the prose for "rate limit"-style strings (Phase 1 hot-fix
|
|
92
89
|
* scoped that pattern set to stderr; Phase 2 removes it entirely).
|
|
93
90
|
*
|
|
94
|
-
* stderr is passed in alongside stdout because
|
|
95
|
-
*
|
|
96
|
-
* on stderr, not in the JSON event stream.
|
|
91
|
+
* stderr is passed in alongside stdout because Codex error envelopes
|
|
92
|
+
* surface refusal state on stderr, not in the JSON event stream.
|
|
97
93
|
*/
|
|
98
94
|
decode(stdout: string, stderr: string, args: string[], log?: StructuredLogger): DecodeResult;
|
|
99
95
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli-adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli-adapters/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAEjD,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,YAAY,EAAE,WAAW,GAAG,iBAAiB,CAAC;IAG9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,yDAAyD;IACzD,eAAe,EAAE;QACf,MAAM,EAAE,kBAAkB,GAAG,SAAS,CAAC;QACvC,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,CAAC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AE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAK5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAK3B,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;IAEH;;;;;;;;;;;;;;OAcG;IACH,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,CAAC,EAAE,gBAAgB,GACrB,YAAY,CAAC;IAEhB;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAAC;CACjF;AAcD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,CAMtD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,EAAE,CAE5C"}
|
|
@@ -3,11 +3,11 @@ export { parseNDJSON } from './shared.js';
|
|
|
3
3
|
// ── Provider Registry ──────────────────────────────────────────────────────
|
|
4
4
|
import { ClaudeAdapter } from './claude-adapter.js';
|
|
5
5
|
import { CodexAdapter } from './codex-adapter.js';
|
|
6
|
-
import {
|
|
6
|
+
import { AgyAdapter } from './agy-adapter.js';
|
|
7
7
|
const providers = {
|
|
8
8
|
claude: new ClaudeAdapter(),
|
|
9
9
|
codex: new CodexAdapter(),
|
|
10
|
-
|
|
10
|
+
agy: new AgyAdapter(),
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
13
13
|
* Get a provider adapter by name.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli-adapters/index.ts"],"names":[],"mappings":"AAUA,6BAA6B;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli-adapters/index.ts"],"names":[],"mappings":"AAUA,6BAA6B;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAoI1C,8EAA8E;AAE9E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,SAAS,GAAiC;IAC9C,MAAM,EAAE,IAAI,aAAa,EAAE;IAC3B,KAAK,EAAE,IAAI,YAAY,EAAE;IACzB,GAAG,EAAE,IAAI,UAAU,EAAE;CACtB,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAa;IACvC,MAAM,QAAQ,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC9B,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAc,CAAC;AAC7C,CAAC"}
|
package/dist/cli-agents.d.ts
CHANGED
|
@@ -7,12 +7,12 @@ export declare const CLAUDE_ALIASES: readonly ["opus", "sonnet", "haiku"];
|
|
|
7
7
|
export interface CLIAgentOptions {
|
|
8
8
|
workingDirectory?: string;
|
|
9
9
|
timeout?: number;
|
|
10
|
-
clis?: ('claude' | 'codex' | '
|
|
10
|
+
clis?: ('claude' | 'codex' | 'agy')[];
|
|
11
11
|
analysisType?: BrutalistPromptType;
|
|
12
12
|
models?: {
|
|
13
13
|
claude?: string;
|
|
14
14
|
codex?: string;
|
|
15
|
-
|
|
15
|
+
agy?: string;
|
|
16
16
|
};
|
|
17
17
|
onStreamingEvent?: (event: StreamingEvent) => void;
|
|
18
18
|
progressToken?: string | number;
|
|
@@ -45,14 +45,14 @@ export interface CLIAgentOrchestratorDeps {
|
|
|
45
45
|
}
|
|
46
46
|
export interface StreamingEvent {
|
|
47
47
|
type: 'agent_start' | 'agent_progress' | 'agent_complete' | 'agent_error';
|
|
48
|
-
agent: 'claude' | 'codex' | '
|
|
48
|
+
agent: 'claude' | 'codex' | 'agy' | 'system';
|
|
49
49
|
content?: string;
|
|
50
50
|
timestamp: number;
|
|
51
51
|
sessionId?: string;
|
|
52
52
|
metadata?: Record<string, any>;
|
|
53
53
|
}
|
|
54
54
|
export interface CLIContext {
|
|
55
|
-
availableCLIs: ('claude' | 'codex' | '
|
|
55
|
+
availableCLIs: ('claude' | 'codex' | 'agy')[];
|
|
56
56
|
}
|
|
57
57
|
export declare class CLIAgentOrchestrator {
|
|
58
58
|
private defaultTimeout;
|
|
@@ -98,37 +98,14 @@ export declare class CLIAgentOrchestrator {
|
|
|
98
98
|
private parseNDJSON;
|
|
99
99
|
private decodeClaudeStreamJson;
|
|
100
100
|
private extractCodexAgentMessage;
|
|
101
|
-
private extractGeminiResponse;
|
|
102
101
|
private emitThrottledStreamingEvent;
|
|
103
102
|
private buildCLICommand;
|
|
104
103
|
detectCLIContext(): Promise<CLIContext>;
|
|
105
|
-
selectSingleCLI(preferredCLI?: 'claude' | 'codex' | '
|
|
104
|
+
selectSingleCLI(preferredCLI?: 'claude' | 'codex' | 'agy', analysisType?: BrutalistPromptType): 'claude' | 'codex' | 'agy';
|
|
106
105
|
private _executeCLI;
|
|
107
106
|
executeClaudeCode(userPrompt: string, systemPromptSpec: string, options?: CLIAgentOptions): Promise<CLIAgentResponse>;
|
|
108
107
|
executeCodex(userPrompt: string, systemPromptSpec: string, options?: CLIAgentOptions): Promise<CLIAgentResponse>;
|
|
109
|
-
|
|
110
|
-
executeSingleCLI(cli: 'claude' | 'codex' | 'gemini', userPrompt: string, systemPromptSpec: string, options?: CLIAgentOptions): Promise<CLIAgentResponse>;
|
|
111
|
-
/**
|
|
112
|
-
* Gemini frontier rotation - iterate through GEMINI_FRONTIER_CHAIN on
|
|
113
|
-
* rotatable failures (capacity saturation OR tier access denial).
|
|
114
|
-
*
|
|
115
|
-
* Only active when neither caller nor operator has chosen a model. Each
|
|
116
|
-
* attempt injects the model via options.models.gemini. Per-attempt
|
|
117
|
-
* failures are classified by isGeminiRotatableError(): capacity errors
|
|
118
|
-
* (quota/429) AND access errors (ModelNotFoundError / permission denied)
|
|
119
|
-
* both trigger rotation. On unrelated failures (auth, prompt rejection,
|
|
120
|
-
* subprocess crashes) rotation stops immediately — a different model
|
|
121
|
-
* will not fix those. On chain exhaustion, the last failing response
|
|
122
|
-
* is returned.
|
|
123
|
-
*
|
|
124
|
-
* In practice the typical non-preview user trajectory is:
|
|
125
|
-
* gemini-3.1-pro-preview -> access denied (rotate)
|
|
126
|
-
* gemini-3-pro-preview -> access denied (rotate)
|
|
127
|
-
* gemini-3-flash-preview -> success (3-series flash, pro-grade
|
|
128
|
-
* reasoning, universally available as
|
|
129
|
-
* of the model launch)
|
|
130
|
-
*/
|
|
131
|
-
private _executeGeminiWithRotation;
|
|
108
|
+
executeSingleCLI(cli: 'claude' | 'codex' | 'agy', userPrompt: string, systemPromptSpec: string, options?: CLIAgentOptions): Promise<CLIAgentResponse>;
|
|
132
109
|
private waitForAvailableSlot;
|
|
133
110
|
executeCLIAgents(cliAgents: string[], systemPrompt: string, userPrompt: string, options?: CLIAgentOptions): Promise<CLIAgentResponse[]>;
|
|
134
111
|
executeCLIAgent(agent: string, systemPrompt: string, userPrompt: string, options?: CLIAgentOptions): Promise<CLIAgentResponse>;
|
package/dist/cli-agents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-agents.d.ts","sourceRoot":"","sources":["../src/cli-agents.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAA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