@aibridge/driver-agy 0.10.0 → 0.10.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/dist/index.mjs CHANGED
@@ -559,6 +559,20 @@ function logForwarder(onStdout, onActivity) {
559
559
  })
560
560
  };
561
561
  }
562
+ const AGY_ERROR_PREFIX = "AGY_ERROR:";
563
+ /**
564
+ * agy 1.5 reports a print timeout as exit 3 plus a machine-readable stderr line:
565
+ * `AGY_ERROR: {"status":"DEADLINE_EXCEEDED","reason":"print_timeout",…}`.
566
+ */
567
+ function isPrintTimeoutError(stderrLine) {
568
+ if (!stderrLine.startsWith(AGY_ERROR_PREFIX)) return false;
569
+ try {
570
+ const parsed = JSON.parse(stderrLine.slice(10));
571
+ return typeof parsed === "object" && parsed !== null && parsed.reason === "print_timeout";
572
+ } catch {
573
+ return false;
574
+ }
575
+ }
562
576
  async function run(task, exec = runCaptured) {
563
577
  const addDirs = task.tools ? [task.cwd] : void 0;
564
578
  let result;
@@ -617,7 +631,7 @@ async function run(task, exec = runCaptured) {
617
631
  };
618
632
  const stderrLines = stripAnsi(result.stderr).split("\n").map((l) => l.trim()).filter((l) => l.length > 0);
619
633
  const lastStderrLine = stderrLines[stderrLines.length - 1] ?? "";
620
- if (result.code === 0 && AGY_PRINT_TIMEOUT_RE.test(lastStderrLine)) return {
634
+ if (result.code === 0 && AGY_PRINT_TIMEOUT_RE.test(lastStderrLine) || stderrLines.some(isPrintTimeoutError)) return {
621
635
  ok: false,
622
636
  kind: "timeout",
623
637
  message: `aibridge: agy timed out after ~${task.timeoutSec}s; raise --timeout.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aibridge/driver-agy",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Antigravity (agy) CLI driver for aibridge",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/agy.test.ts CHANGED
@@ -4,14 +4,14 @@ import { agySupportsStreamJson, buildAgyPrintArgs } from './agy.ts';
4
4
  describe('buildAgyPrintArgs', () => {
5
5
  it('assembles default agy args', () => {
6
6
  const args = buildAgyPrintArgs('test prompt', {
7
- model: 'gemini-3.7-flash-high',
7
+ model: 'gemini-3.8-flash-high',
8
8
  printTimeoutSec: 600,
9
9
  });
10
10
  expect(args).toEqual([
11
11
  '-p',
12
12
  'test prompt',
13
13
  '--model',
14
- 'gemini-3.7-flash-high',
14
+ 'gemini-3.8-flash-high',
15
15
  '--print-timeout',
16
16
  '600s',
17
17
  ]);
@@ -19,7 +19,7 @@ describe('buildAgyPrintArgs', () => {
19
19
 
20
20
  it('preserves order of skipPermissions and addDirs', () => {
21
21
  const args = buildAgyPrintArgs('test prompt', {
22
- model: 'gemini-3.7-flash-high',
22
+ model: 'gemini-3.8-flash-high',
23
23
  printTimeoutSec: 600,
24
24
  skipPermissions: true,
25
25
  addDirs: ['/work/repo', '/tmp/answer-dir'],
@@ -28,7 +28,7 @@ describe('buildAgyPrintArgs', () => {
28
28
  '-p',
29
29
  'test prompt',
30
30
  '--model',
31
- 'gemini-3.7-flash-high',
31
+ 'gemini-3.8-flash-high',
32
32
  '--print-timeout',
33
33
  '600s',
34
34
  '--dangerously-skip-permissions',
@@ -112,7 +112,7 @@ test('findModelQuota hits modelId id-form', () => {
112
112
  groups: [],
113
113
  models: [
114
114
  {
115
- modelId: 'gemini-3.7-flash-high',
115
+ modelId: 'gemini-3.8-flash-high',
116
116
  label: 'Gemini 3.7 Flash (High)',
117
117
  remainingFraction: 0.9,
118
118
  exhausted: false,
@@ -121,8 +121,8 @@ test('findModelQuota hits modelId id-form', () => {
121
121
  ],
122
122
  };
123
123
 
124
- const found = findModelQuota(snapshot, 'gemini-3.7-flash-high');
125
- assert.equal(found?.modelId, 'gemini-3.7-flash-high');
124
+ const found = findModelQuota(snapshot, 'gemini-3.8-flash-high');
125
+ assert.equal(found?.modelId, 'gemini-3.8-flash-high');
126
126
  });
127
127
 
128
128
  test('decodeKeyringSecret accepts raw JSON (linux) and go-keyring base64 (macOS)', () => {
@@ -9,7 +9,7 @@ describe('generateImage', () => {
9
9
  const baseReq: ImageGenRequest = {
10
10
  prompt: 'A futuristic city skyline',
11
11
  workDir: '/tmp/work',
12
- backendModel: 'gemini-3.7-flash-high',
12
+ backendModel: 'gemini-3.8-flash-high',
13
13
  aspectRatio: undefined,
14
14
  imagePaths: [],
15
15
  timeoutSec: 600,
@@ -45,7 +45,7 @@ describe('generateImage', () => {
45
45
 
46
46
  expect(capturedCmd).toBe('agy');
47
47
  expect(capturedArgs).toContain('--model');
48
- expect(capturedArgs).toContain('gemini-3.7-flash-high');
48
+ expect(capturedArgs).toContain('gemini-3.8-flash-high');
49
49
  expect(capturedArgs).toContain('--dangerously-skip-permissions');
50
50
  expect(capturedArgs).not.toContain('--output-format');
51
51
  expect(capturedArgs).not.toContain('stream-json');
package/src/run.test.ts CHANGED
@@ -80,7 +80,7 @@ describe('agy driver argv / version handling', () => {
80
80
  tools: false,
81
81
  timeoutSec: 60,
82
82
  cwd: '/test/cwd',
83
- backendModel: 'gemini-3.7-flash-high',
83
+ backendModel: 'gemini-3.8-flash-high',
84
84
  },
85
85
  fake.exec,
86
86
  );
@@ -94,7 +94,7 @@ describe('agy driver argv / version handling', () => {
94
94
  '-p',
95
95
  'do something',
96
96
  '--model',
97
- 'gemini-3.7-flash-high',
97
+ 'gemini-3.8-flash-high',
98
98
  '--print-timeout',
99
99
  '60s',
100
100
  '--output-format',
@@ -113,7 +113,7 @@ describe('agy driver argv / version handling', () => {
113
113
  tools: false,
114
114
  timeoutSec: 60,
115
115
  cwd: '/test/cwd',
116
- backendModel: 'gemini-3.7-flash-high',
116
+ backendModel: 'gemini-3.8-flash-high',
117
117
  },
118
118
  fake.exec,
119
119
  );
@@ -125,7 +125,7 @@ describe('agy driver argv / version handling', () => {
125
125
  '-p',
126
126
  'do something',
127
127
  '--model',
128
- 'gemini-3.7-flash-high',
128
+ 'gemini-3.8-flash-high',
129
129
  '--print-timeout',
130
130
  '60s',
131
131
  ]);
@@ -143,7 +143,7 @@ describe('agy driver argv / version handling', () => {
143
143
  tools: false,
144
144
  timeoutSec: 60,
145
145
  cwd: '/test/cwd',
146
- backendModel: 'gemini-3.7-flash-high',
146
+ backendModel: 'gemini-3.8-flash-high',
147
147
  },
148
148
  fake.exec,
149
149
  );
@@ -168,7 +168,7 @@ describe('agy driver argv / version handling', () => {
168
168
  tools: true,
169
169
  timeoutSec: 100,
170
170
  cwd: '/repo/root',
171
- backendModel: 'gemini-3.7-flash-high',
171
+ backendModel: 'gemini-3.8-flash-high',
172
172
  },
173
173
  fake.exec,
174
174
  );
@@ -195,7 +195,7 @@ describe('agy no-tools stream-json parsing (1.2.3)', () => {
195
195
  tools: false,
196
196
  timeoutSec: 30,
197
197
  cwd: '/work',
198
- backendModel: 'gemini-3.7-flash-high',
198
+ backendModel: 'gemini-3.8-flash-high',
199
199
  };
200
200
 
201
201
  const stepUpdate = (
@@ -410,7 +410,7 @@ describe('agy tools stream-json parsing', () => {
410
410
  tools: true,
411
411
  timeoutSec: 30,
412
412
  cwd: '/work',
413
- backendModel: 'gemini-3.7-flash-high',
413
+ backendModel: 'gemini-3.8-flash-high',
414
414
  };
415
415
 
416
416
  it('logs tool ACTIVE and DONE concisely without dumping heavy payloads', async () => {
@@ -455,9 +455,45 @@ describe('agy timeout and error handling', () => {
455
455
  tools: false,
456
456
  timeoutSec: 1,
457
457
  cwd: '/work',
458
- backendModel: 'gemini-3.7-flash-high',
458
+ backendModel: 'gemini-3.8-flash-high',
459
459
  };
460
460
 
461
+ it('maps the agy 1.5 AGY_ERROR print_timeout line (exit 3) to timeout', async () => {
462
+ const stderr = [
463
+ '[agy] print timeout after 1s with turn in progress; returning partial output',
464
+ 'error: print timeout after 1s with the turn still in progress; the response is partial',
465
+ 'AGY_ERROR: {"short_error":"print timeout after 1s with the turn still in progress; the response is partial","status":"DEADLINE_EXCEEDED","retryable":false,"reason":"print_timeout"}',
466
+ '',
467
+ ].join('\n');
468
+ const stream = [
469
+ JSON.stringify({ event: 'init' }),
470
+ JSON.stringify({
471
+ event: 'result',
472
+ result: { status: 'ERROR', response: '', error: 'print timeout after 1s' },
473
+ }),
474
+ '',
475
+ ].join('\n');
476
+
477
+ const res = await run(
478
+ task,
479
+ fakeAgy({ version: 'agy 1.5.15', stdout: stream, stderr, code: 3 }).exec,
480
+ );
481
+
482
+ expect(res.ok).toBe(false);
483
+ if (!res.ok) expect(res.kind).toBe('timeout');
484
+ });
485
+
486
+ it('keeps another AGY_ERROR reason as no-answer', async () => {
487
+ const stderr = 'AGY_ERROR: {"status":"NOT_FOUND","reason":"unknown_model"}\n';
488
+ const res = await run(
489
+ task,
490
+ fakeAgy({ version: 'agy 1.5.15', stdout: '', stderr, code: 1 }).exec,
491
+ );
492
+
493
+ expect(res.ok).toBe(false);
494
+ if (!res.ok) expect(res.kind).toBe('no-answer');
495
+ });
496
+
461
497
  it('maps soft print-timeout stderr on stream path to timeout with ~1s message', async () => {
462
498
  const stderr = '[agy] print timeout after 1s with turn in progress; returning partial output\n';
463
499
  const stream = [
@@ -623,7 +659,7 @@ describe('agy spawn failure handling', () => {
623
659
  tools: false,
624
660
  timeoutSec: 10,
625
661
  cwd: '/work',
626
- backendModel: 'gemini-3.7-flash-high',
662
+ backendModel: 'gemini-3.8-flash-high',
627
663
  };
628
664
 
629
665
  it('maps ENOENT spawn error to not-found', async () => {
package/src/run.ts CHANGED
@@ -293,6 +293,26 @@ function logForwarder(
293
293
  };
294
294
  }
295
295
 
296
+ const AGY_ERROR_PREFIX = 'AGY_ERROR:';
297
+
298
+ /**
299
+ * agy 1.5 reports a print timeout as exit 3 plus a machine-readable stderr line:
300
+ * `AGY_ERROR: {"status":"DEADLINE_EXCEEDED","reason":"print_timeout",…}`.
301
+ */
302
+ function isPrintTimeoutError(stderrLine: string): boolean {
303
+ if (!stderrLine.startsWith(AGY_ERROR_PREFIX)) return false;
304
+ try {
305
+ const parsed: unknown = JSON.parse(stderrLine.slice(AGY_ERROR_PREFIX.length));
306
+ return (
307
+ typeof parsed === 'object' &&
308
+ parsed !== null &&
309
+ (parsed as { reason?: unknown }).reason === 'print_timeout'
310
+ );
311
+ } catch {
312
+ return false;
313
+ }
314
+ }
315
+
296
316
  export async function run(
297
317
  task: DelegationTask,
298
318
  exec: typeof runCaptured = runCaptured,
@@ -378,7 +398,10 @@ export async function run(
378
398
  .map(l => l.trim())
379
399
  .filter(l => l.length > 0);
380
400
  const lastStderrLine = stderrLines[stderrLines.length - 1] ?? '';
381
- if (result.code === 0 && AGY_PRINT_TIMEOUT_RE.test(lastStderrLine)) {
401
+ if (
402
+ (result.code === 0 && AGY_PRINT_TIMEOUT_RE.test(lastStderrLine)) ||
403
+ stderrLines.some(isPrintTimeoutError)
404
+ ) {
382
405
  return {
383
406
  ok: false,
384
407
  kind: 'timeout',