pi-agy-provider 1.1.6 → 1.1.8

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/index.ts CHANGED
@@ -4335,7 +4335,7 @@ export default function antigravityExtension(pi: ExtensionAPI): void {
4335
4335
 
4336
4336
  const consultCommandOptions = {
4337
4337
  description:
4338
- "Switch or one-shot consult model: /m <opus|sonnet|argon|carbon|hydrogen|flash>[1|2|3|4] [prompt] (omit prompt to switch; with prompt, consults for 1 turn)",
4338
+ "Switch or one-shot consult model: /m <opus|sonnet|neon|argon|carbon|hydrogen|flash>[1|2|3|4] [prompt] (omit prompt to switch; with prompt, consults for 1 turn)",
4339
4339
  getArgumentCompletions: (argumentPrefix: string) => {
4340
4340
  const probedModelId = activeSessionCtx
4341
4341
  ? probeCtx(() =>
@@ -447,6 +447,7 @@ export class AgyAcpDriverSession implements AgyTurnExecutor {
447
447
  {
448
448
  ...(this.#logDir ? { logDir: this.#logDir } : {}),
449
449
  ...(child.pid !== undefined ? { pid: child.pid } : {}),
450
+ ...(request.model ? { modelId: request.model } : {}),
450
451
  emitThinkingDeltas: false,
451
452
  emitStepUsage: true,
452
453
  },
package/lib/agy-client.ts CHANGED
@@ -259,7 +259,7 @@ function appendProcessArgs(args: string[], request: AgyTurnRequest): string[] {
259
259
  }
260
260
 
261
261
  export const READ_ONLY_AGY_SETTINGS_JSON = JSON.stringify({
262
- agentMode: "default",
262
+ agentMode: "",
263
263
  toolPermission: "strict",
264
264
  permissions: { allow: [] },
265
265
  });
@@ -433,7 +433,11 @@ async function runSingleAgyTurn(request: AgyTurnRequest): Promise<AgyTurnOutcome
433
433
  resolve(outcome);
434
434
  return;
435
435
  }
436
- const thoughtTracker = new AgyThoughtTracker(request.conversationId);
436
+ const thoughtTracker = new AgyThoughtTracker(
437
+ request.conversationId,
438
+ undefined,
439
+ request.model ? { modelId: request.model } : undefined,
440
+ );
437
441
  if (request.conversationId) {
438
442
  prepareAgyConversationBridgeMetadata(
439
443
  request.conversationId,
@@ -8,8 +8,8 @@ import which from "which";
8
8
  import { killAgyTree, trackAgyChild, untrackAgyChild } from "./agy-children.ts";
9
9
 
10
10
  export const MIN_AGY_VERSION = "1.1.22";
11
- /** Soft target: includes ACP session/cancel fixes (1.5.4+), 1.5.8–1.5.9 ACP auth/error/diff fixes, and 1.5.10 10m stream / 4m rate-limit / ACP background cleanup fixes. */
12
- export const RECOMMENDED_AGY_VERSION = "1.5.10";
11
+ /** Soft target: includes ACP session/cancel fixes (1.5.4+), 1.5.8–1.5.10 ACP/10m-stream/4m-retry fixes, and 1.5.11–1.5.12 Gemini 4 Neon + connection-reset retry fixes. */
12
+ export const RECOMMENDED_AGY_VERSION = "1.5.12";
13
13
  export function isBelowRecommendedAgy(version: string | undefined): boolean {
14
14
  return Boolean(version && valid(version) && !gte(version, RECOMMENDED_AGY_VERSION));
15
15
  }
package/lib/agy-driver.ts CHANGED
@@ -308,8 +308,10 @@ export class AgyDriverSession implements AgyTurnExecutor {
308
308
  conversationId: string | undefined,
309
309
  ) => Promise<AgySubagentProbeResult> = agyProbeSubagents;
310
310
  /** Test seam for creating per-turn SQLite/CLI-log thought & compaction trackers. */
311
- #createThoughtTracker: (conversationId?: string) => AgyThoughtTracker = (conversationId) =>
312
- new AgyThoughtTracker(conversationId);
311
+ #createThoughtTracker: (conversationId?: string, modelId?: string) => AgyThoughtTracker = (
312
+ conversationId,
313
+ modelId,
314
+ ) => new AgyThoughtTracker(conversationId, undefined, modelId ? { modelId } : undefined);
313
315
  #parkedPollMs = STALL_PARKED_POLL_MS;
314
316
  #parkedLimit = STALL_PARKED_LIMIT;
315
317
  /** Early parked-answer watch interval; 0 disables it (stall budget only). */
@@ -590,6 +592,7 @@ export class AgyDriverSession implements AgyTurnExecutor {
590
592
  conversationReported: false,
591
593
  thoughtTracker: this.#createThoughtTracker(
592
594
  request.conversationId ?? this.#boundConversationId,
595
+ request.model,
593
596
  ),
594
597
  stallGraces: 0,
595
598
  parkedChecks: 0,
@@ -1522,7 +1525,7 @@ function configuredDriverMode(env: NodeJS.ProcessEnv): string | undefined {
1522
1525
  }
1523
1526
 
1524
1527
  export function resolveAgyDriverMode(env: NodeJS.ProcessEnv = process.env): AgyDriverMode {
1525
- return normalizeAgyDriverMode(configuredDriverMode(env)) ?? "acp";
1528
+ return normalizeAgyDriverMode(configuredDriverMode(env)) ?? "stream-json";
1526
1529
  }
1527
1530
 
1528
1531
  export function createAgyTurnExecutorForMode(mode: AgyDriverMode): AgyTurnExecutor {
@@ -1539,7 +1542,7 @@ export class SwitchableAgyTurnExecutor implements AgyTurnExecutor {
1539
1542
  #mode: AgyDriverMode;
1540
1543
  #current: AgyTurnExecutor;
1541
1544
 
1542
- constructor(initialMode: AgyDriverMode = "acp") {
1545
+ constructor(initialMode: AgyDriverMode = "stream-json") {
1543
1546
  this.#mode = initialMode;
1544
1547
  this.#current = createAgyTurnExecutorForMode(initialMode);
1545
1548
  }
@@ -23,6 +23,7 @@ import { closeSync, existsSync, openSync, readdirSync, readSync, statSync } from
23
23
  import { homedir } from "node:os";
24
24
  import { dirname, join } from "node:path";
25
25
  import { DatabaseSync } from "node:sqlite";
26
+ import { resolveAgyEffectiveContextLimit } from "./footer.ts";
26
27
  import { cleanAgyCheckpointSummary } from "./agy-compaction.ts";
27
28
  import type { AgyActivity, AgyUsage } from "./reducer.ts";
28
29
 
@@ -37,9 +38,20 @@ const STEP_STATUS_DONE = 3;
37
38
  const STEP_STATUS_CANCELED = 5;
38
39
  const STEP_STATUS_GENERATING = 8;
39
40
 
40
- /** Minimum context tokens before an unindexed streamGenerateContent call can be compaction. */
41
+ /** Minimum context tokens before an unindexed streamGenerateContent call can be compaction (when modelId is unknown). */
41
42
  const MIN_COMPACTION_CONTEXT_TOKENS = 100_000;
42
43
 
44
+ /**
45
+ * Compute minimum context occupancy before an unindexed `streamGenerateContent`
46
+ * log line is treated as a live compaction call (SQLite `CHECKPOINT` steps still
47
+ * report compaction immediately at any token count).
48
+ */
49
+ export function minCompactionContextTokensForModel(modelId?: string): number {
50
+ if (!modelId) return MIN_COMPACTION_CONTEXT_TOKENS;
51
+ const limit = resolveAgyEffectiveContextLimit(modelId);
52
+ return limit >= 500_000 ? Math.round(limit * 0.7) : Math.round(limit * 0.55);
53
+ }
54
+
43
55
  /** Default total attempts in agy's internal model retry loop (`ModelRequestStatus.max_attempts = 10`). */
44
56
  export const AGY_DEFAULT_MAX_RETRY_ATTEMPTS = 10;
45
57
 
@@ -174,6 +186,8 @@ export interface AgyThoughtTrackerOptions {
174
186
  logDir?: string;
175
187
  /** Spawned `agy acp` / `agy` PID for direct `acp-server-*-<pid>.log` binding. */
176
188
  pid?: number;
189
+ /** Active model ID used to scale the CLI-log compaction heuristic threshold. */
190
+ modelId?: string;
177
191
  /** Clock override for deterministic compaction-grace tests. */
178
192
  now?: () => number;
179
193
  /**
@@ -732,6 +746,7 @@ export class AgyThoughtTracker {
732
746
  #emittedRetrying = false;
733
747
  #emitThinkingDeltas = true;
734
748
  #emitStepUsage = false;
749
+ #minCompactionContextTokens = MIN_COMPACTION_CONTEXT_TOKENS;
735
750
  #checkpointDetailsByStepId = new Map<number, AgyCheckpointSummaryInfo>();
736
751
  #streamEmittedCheckpoints = new Set<number>();
737
752
 
@@ -743,6 +758,7 @@ export class AgyThoughtTracker {
743
758
  this.#conversationsDir = conversationsDir;
744
759
  this.#logDir = options?.logDir ?? defaultLogDirFromConversationsDir(conversationsDir);
745
760
  this.#pid = options?.pid;
761
+ this.#minCompactionContextTokens = minCompactionContextTokensForModel(options?.modelId);
746
762
  this.#now = options?.now ?? Date.now;
747
763
  this.#emitThinkingDeltas = options?.emitThinkingDeltas ?? true;
748
764
  this.#emitStepUsage = options?.emitStepUsage ?? false;
@@ -1520,7 +1536,7 @@ export class AgyThoughtTracker {
1520
1536
  }
1521
1537
 
1522
1538
  return (
1523
- (this.#lastContextTokens ?? 0) >= MIN_COMPACTION_CONTEXT_TOKENS &&
1539
+ (this.#lastContextTokens ?? 0) >= this.#minCompactionContextTokens &&
1524
1540
  overallMaxIdx >= 2 &&
1525
1541
  this.#compactedAfterIdx < overallMaxIdx &&
1526
1542
  nowMs - this.#activeStreamStartedAtMs >= COMPACTION_STREAM_GRACE_MS
package/lib/models.ts CHANGED
@@ -156,6 +156,12 @@ export function resolveAgyModelEffort(
156
156
 
157
157
  /** Complete fallback catalog from `agy models`, including effort constraints. */
158
158
  export const ALL_FALLBACK_MODELS: AgyModelInfo[] = [
159
+ {
160
+ id: "gemini-4-neon",
161
+ name: "Gemini 4 Neon",
162
+ supportedEfforts: ["high", "xhigh", "medium", "low"],
163
+ defaultEffort: "high",
164
+ },
159
165
  {
160
166
  id: "gemini-4-argon",
161
167
  name: "Gemini 4 Argon",
@@ -296,6 +302,7 @@ export function modelCacheIsFresh(
296
302
  export const CONSULT_MODEL_ALIASES: Readonly<Record<string, string>> = {
297
303
  opus: "claude-opus-5-5",
298
304
  sonnet: "claude-sonnet-5-5",
305
+ neon: "gemini-4-neon",
299
306
  argon: "gemini-4-argon",
300
307
  carbon: "gemini-4-carbon",
301
308
  hydrogen: "gemini-4-hydrogen",
@@ -368,7 +375,7 @@ export type ResolvedAgyConsultSpec =
368
375
  };
369
376
 
370
377
  export const CONSULT_USAGE_MESSAGE =
371
- 'Usage: /m <opus|sonnet|argon|carbon|hydrogen|flash>[1|2|3|4] [prompt] (thinking: 1=low, 2=mid, 3=high, 4=xhigh, omit=session current)';
378
+ 'Usage: /m <opus|sonnet|neon|argon|carbon|hydrogen|flash>[1|2|3|4] [prompt] (thinking: 1=low, 2=mid, 3=high, 4=xhigh, omit=session current)';
372
379
 
373
380
  /**
374
381
  * Parse `/m <spec> [prompt]` arguments.
@@ -399,7 +406,7 @@ export function resolveAgyConsultSpec(
399
406
  let explicitEffort: AgyEffort | undefined;
400
407
 
401
408
  const aliasMatch = rawSpec.match(
402
- /^(opus|sonnet|argon|carbon|hydrogen|flash)(?:[-:]?(1|2|3|4|low|mid|medium|high|xhigh|extra|max))?$/i,
409
+ /^(opus|sonnet|neon|argon|carbon|hydrogen|flash)(?:[-:]?(1|2|3|4|low|mid|medium|high|xhigh|extra|max))?$/i,
403
410
  );
404
411
  if (aliasMatch) {
405
412
  modelToken = aliasMatch[1]!;
@@ -418,7 +425,7 @@ export function resolveAgyConsultSpec(
418
425
  if (!model) {
419
426
  return {
420
427
  ok: false,
421
- error: `Unknown model "${rawSpec}". Supported aliases: opus, sonnet, argon, carbon, hydrogen, flash (with optional 1=low, 2=mid, 3=high, 4=xhigh).`,
428
+ error: `Unknown model "${rawSpec}". Supported aliases: opus, sonnet, neon, argon, carbon, hydrogen, flash (with optional 1=low, 2=mid, 3=high, 4=xhigh).`,
422
429
  };
423
430
  }
424
431
 
@@ -454,7 +461,7 @@ export function getAgyConsultCompletions(
454
461
  if (argumentPrefix.includes(" ")) return null;
455
462
  const prefix = argumentPrefix.trim().toLowerCase();
456
463
  const activeId = currentModelId?.trim().toLowerCase();
457
- const aliases = ["hydrogen", "carbon", "argon", "opus", "sonnet", "flash"] as const;
464
+ const aliases = ["neon", "hydrogen", "carbon", "argon", "opus", "sonnet", "flash"] as const;
458
465
  const items: Array<{ value: string; label: string; description: string }> = [];
459
466
 
460
467
  for (const alias of aliases) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-agy-provider",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "Use Antigravity (agy) models inside the pi coding agent via the agy stream-json RPC, with pi as the UI.",
5
5
  "type": "module",
6
6
  "keywords": [