@estebanforge/pi-antigravity-bridge 1.16.1 → 1.17.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/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.17.1] - 2026-11-29
6
+
7
+ ### Fixed
8
+
9
+ - The display-only `antigravity` replay wrapper is no longer declared to models or listed in codemode's catalog of callable tools. It stayed in every model's tool list (empty description, internal `key` argument) for every provider, costing prompt tokens and inviting fabricated calls. It remains active so the provider's replay calls still execute and render.
10
+
11
+ ## [1.17.0] - 2026-11-29
12
+
13
+ ### Added
14
+
15
+ - A consent gate for the stream-json engine (google-antigravity/antigravity-cli#1890). Existing installs resolved to stream-json see a one-time warning modal at start: on agy 1.5.17+ its turns bill at the 4× custom-agent quota rate and it is not a Google-documented integration path for third-party clients. Every path that selects stream-json (first-run picker, `/agy engine stream-json`, the settings row) shows the same modal before the choice applies; keeping stream-json records the acknowledgment so the warning never re-asks, esc decides later and re-asks next start. The acknowledgment persists only after a modal decision — a bare `/agy engine acp` or a headless stream-json apply leaves it unset so the next interactive start still asks. Headless runs apply with a one-line notice instead of a modal. ACP is the standard-rate path; existing installs resolved to stream-json will see the modal once on their next interactive start.
16
+
17
+
5
18
  ## [1.16.1] - 2026-11-28
6
19
 
7
20
  ### Fixed
package/README.md CHANGED
@@ -16,9 +16,9 @@ Multi-turn works. The provider binds a pi session to an agy conversation id (per
16
16
  Turns run through one of two engines behind the same provider surface (`config.engine`, default `acp`):
17
17
 
18
18
  - **acp** (default): the ACP server built into the `agy` CLI (`agy acp`), JSON-RPC 2.0 over stdio. Verified live on agy 1.5.3: text streaming, exact token usage, multi-turn resume via `session/load`, bridge tools, separate model/thinking options, and notification-based cancellation. Client-side usage estimates remain as a fallback if the server omits usage.
19
- - **stream-json** (fallback): the persistent `agy` CLI process. Live token usage; conversation resume via `--conversation`.
19
+ - **stream-json** (fallback): the persistent `agy` CLI process. Live token usage; conversation resume via `--conversation`. On agy 1.5.17 and later, its turns bill at the custom-agent quota rate (4× Gemini quota per token): the staged system prompt goes through `--agent`, and the higher rate is vendor-intentional ([google-antigravity/antigravity-cli#1890](https://github.com/google-antigravity/antigravity-cli/issues/1890)). The acp engine never passes `--agent` and keeps the standard rate.
20
20
 
21
- The choice of engine is left to the user: a first-run picker asks once on a fresh install (acp preselected; `esc` defers), and `/agy engine` reopens it anytime. Both engines use the same `agy` installation and cached Google credentials. A restart applies an engine switch. Sessions are engine-scoped, so switching engines never crosses conversations.
21
+ The choice of engine is left to the user: a first-run picker asks once on a fresh install (acp preselected; `esc` defers), and `/agy engine` reopens it anytime. Selecting stream-json anywhere (first-run picker, `/agy engine`, settings row) shows a one-time warning modal first; keeping it records the acknowledgment and the warning never re-asks, esc decides later. Both engines use the same `agy` installation and cached Google credentials. A restart applies an engine switch. Sessions are engine-scoped, so switching engines never crosses conversations.
22
22
 
23
23
  Full capability comparison, switching, and setup/auth details: [docs/ENGINES.md](docs/ENGINES.md). Existing installs remove only old ACP builds with managed-install evidence under the bridge's old install root. Unmarked binaries and unrelated files stay untouched. Retired standalone credentials are reported for manual removal, never deleted automatically.
24
24
 
@@ -70,7 +70,7 @@ import { createAgySetupOffer } from "../src/agy-setup.js";
70
70
  import { ensureQueuedMessagesDefaults } from "../src/queued-messages.js";
71
71
  import type { TurnDriver, TurnOutcome } from "../src/driver-types.js";
72
72
  import { configPath, configWarningsMessage, loadConfig, logsDir, MAX_TURN_CAP_MIN, migrateStaleDigestDefault, parseCapMinutes, removeLegacyAcpBin, saveConfig, type AcpConfig, type AgyMode, type BridgeTools, type Engine, type ThinkingTier } from "../src/config.js";
73
- import { agyMissingMessage, ENGINE_SETTINGS_ROW_ID, engineSettingsRow, isAgyInstalled, savedEngineMessage, showEnginePicker, shouldOfferEnginePicker } from "../src/engine-picker.js";
73
+ import { agyMissingMessage, ENGINE_SETTINGS_ROW_ID, engineSettingsRow, isAgyInstalled, savedEngineMessage, shouldOfferEnginePicker, shouldWarnStreamJson, showEnginePicker, showStreamJsonWarning, streamJsonKeptMessage, streamJsonSavePatch } from "../src/engine-picker.js";
74
74
  import { agyVersionVerdict, agyUpdateMessage, checkAgyCliVersion, describeAgyVersionCheck, MIN_AGY_ACP_VERSION, MIN_AGY_VERSION, MIN_GEMINI_DIR_VERSION, probeGeminiDirFlag, resolveStreamHomeMode } from "../src/agy-version.js";
75
75
  import { isValidAgyAgentName, listAgyAgents } from "../src/agents.js";
76
76
  import { formatSubagentRoster, SubagentRoster } from "../src/subagent-roster.js";
@@ -805,10 +805,16 @@ export default async function (pi: ExtensionAPI): Promise<void> {
805
805
  // toolCalls against it (never re-executed - execute() replays the output
806
806
  // agy already recorded). Empty description on purpose: no model should
807
807
  // call it, it exists so pi renders proper toolCall/toolResult cards.
808
+ // It must stay active, since pi executes only active tools and the
809
+ // provider's emitted calls would otherwise fail "not found", but
810
+ // prepareLoadout leaves its declaration out of every model request and
811
+ // model-only exposure keeps it out of codemode's callable catalog.
808
812
  pi.registerTool({
809
813
  name: "antigravity",
810
814
  label: "Antigravity",
811
815
  description: "",
816
+ exposure: "model-only",
817
+ prepareLoadout: () => ({ hiddenDeclarations: ["antigravity"] }),
812
818
  parameters: Type.Object({
813
819
  tool: Type.String({ description: "agy tool name that produced this step." }),
814
820
  key: Type.String({ description: "Internal replay key. Do not fabricate." }),
@@ -892,15 +898,63 @@ export default async function (pi: ExtensionAPI): Promise<void> {
892
898
  try {
893
899
  const picked = await showEnginePicker(ctx.ui);
894
900
  if (picked) {
895
- setupEngine = picked;
896
- saveConfig({ engine: picked });
897
- ctx.ui.notify(savedEngineMessage(picked), "info");
901
+ // Consent gate: a first-run stream-json pick gets the same
902
+ // warning as every other path before it persists anything.
903
+ let chosen: Engine | undefined = picked;
904
+ if (picked === "stream-json") {
905
+ const verdict = await showStreamJsonWarning(ctx.ui);
906
+ if (verdict === undefined) {
907
+ // Decide later: nothing persisted, this session runs the
908
+ // acp default, the picker re-asks next start.
909
+ ctx.ui.notify("Stream-json not confirmed; this session runs the acp default. Decide later with /agy engine.", "info");
910
+ chosen = undefined;
911
+ } else {
912
+ chosen = verdict === "acp" ? "acp" : "stream-json";
913
+ if (chosen === "stream-json") ctx.ui.notify(streamJsonKeptMessage(), "warning");
914
+ }
915
+ }
916
+ if (chosen) {
917
+ setupEngine = chosen;
918
+ saveConfig(streamJsonSavePatch(chosen, chosen === "stream-json"));
919
+ ctx.ui.notify(savedEngineMessage(chosen), "info");
920
+ }
898
921
  }
899
922
  } catch (err) {
900
923
  fileLog.log("engine-picker", { error: String(err) }, "warn");
901
924
  console.error(`[antigravity-bridge] engine picker failed: ${String(err)}`);
902
925
  }
903
926
  }
927
+ // stream-json consent migration (google-antigravity/antigravity-cli#1890):
928
+ // existing installs resolved to stream-json (the legacy silent fallback or
929
+ // an old explicit choice) see the warning once; esc re-asks next start,
930
+ // exactly like the first-run picker. AGY_ENGINE=stream-json skips the
931
+ // modal: typing the env var is the explicit act. The switch persists for
932
+ // the next start (drivers wire at load), like /agy engine.
933
+ try {
934
+ const cfg = loadConfig();
935
+ if (
936
+ (event.reason === "startup" || event.reason === "resume") &&
937
+ ctx.mode === "tui" &&
938
+ process.env.AGY_ENGINE === undefined &&
939
+ shouldWarnStreamJson(cfg.engine, cfg.streamJsonAcknowledged)
940
+ ) {
941
+ const verdict = await showStreamJsonWarning(ctx.ui);
942
+ if (verdict === "keep") {
943
+ saveConfig(streamJsonSavePatch("stream-json", true));
944
+ ctx.ui.notify(streamJsonKeptMessage(), "warning");
945
+ } else if (verdict === "acp" && loadConfig().mode !== "plan") {
946
+ saveConfig(streamJsonSavePatch("acp", true));
947
+ ctx.ui.notify(savedEngineMessage("acp"), "info");
948
+ } else if (verdict === "acp") {
949
+ // Plan mode blocks ACP: refuse without persisting so the
950
+ // modal re-asks once the mode allows the switch.
951
+ ctx.ui.notify("mode is plan; provider plan turns are disabled on ACP. /agy mode accept-edits first.", "warning");
952
+ }
953
+ }
954
+ } catch (err) {
955
+ fileLog.log("streamjson-warning", { error: String(err) }, "warn");
956
+ console.error(`[antigravity-bridge] stream-json warning failed: ${String(err)}`);
957
+ }
904
958
  // The retired acp.bin key heals itself in the config file; the env var
905
959
  // lives outside our reach, so it is the only case that still warns.
906
960
  // Independent once-flags: a failed cleanup must never suppress the
@@ -1495,7 +1549,30 @@ function registerAgyCommand(pi: ExtensionAPI, ctx: AgyCommandCtx): void {
1495
1549
  ui?.notify("mode is plan; provider plan turns are disabled on ACP. /agy mode accept-edits first.", "warning");
1496
1550
  return;
1497
1551
  }
1498
- const next = saveConfig({ engine: val });
1552
+ // Consent gate (google-antigravity/antigravity-cli#1890): the
1553
+ // TUI warning modal runs once, before stream-json ever takes
1554
+ // effect. Headless has no modal surface: apply with the
1555
+ // one-line notice instead.
1556
+ let engineChoice: "acp" | "stream-json" = val;
1557
+ let warned = false;
1558
+ if (engineChoice === "stream-json" && shouldWarnStreamJson("stream-json", loadConfig().streamJsonAcknowledged)) {
1559
+ if (!ui || mode !== "tui") {
1560
+ ui?.notify(streamJsonKeptMessage(), "warning");
1561
+ } else {
1562
+ const verdict = await showStreamJsonWarning(ui);
1563
+ if (verdict === undefined) {
1564
+ ui.notify(`engine unchanged: ${loadConfig().engine}.`, "info");
1565
+ return;
1566
+ }
1567
+ if (verdict === "acp" && loadConfig().mode === "plan") {
1568
+ ui.notify("mode is plan; provider plan turns are disabled on ACP. /agy mode accept-edits first.", "warning");
1569
+ return;
1570
+ }
1571
+ engineChoice = verdict === "acp" ? "acp" : "stream-json";
1572
+ warned = true;
1573
+ }
1574
+ }
1575
+ const next = saveConfig(streamJsonSavePatch(engineChoice, warned));
1499
1576
  if (next.engine !== "acp") {
1500
1577
  ui?.notify("engine set to stream-json. Takes effect on the next pi start (or /reload).", "info");
1501
1578
  return;
@@ -2231,7 +2308,7 @@ async function openAgyPicker(ui: ExtensionUIContext, ctx: AgyCommandCtx): Promis
2231
2308
  * same semantics: plan blocks acp and restart applies the switch. */
2232
2309
  async function runEngineModal(ui: ExtensionUIContext, ctx: AgyCommandCtx): Promise<void> {
2233
2310
  const current = loadConfig().engine;
2234
- const picked = await showEnginePicker(ui);
2311
+ let picked = await showEnginePicker(ui);
2235
2312
  if (picked === undefined) {
2236
2313
  ui.notify(`engine unchanged: ${current}.`, "info");
2237
2314
  return;
@@ -2240,6 +2317,22 @@ async function runEngineModal(ui: ExtensionUIContext, ctx: AgyCommandCtx): Promi
2240
2317
  ui.notify(`engine is already ${current}. Restart applies it if set this session.`, "info");
2241
2318
  return;
2242
2319
  }
2320
+ // Consent gate: picking stream-json in the picker resolves only after the
2321
+ // warning; esc lands here as undefined above, so nothing is persisted.
2322
+ if (picked === "stream-json" && shouldWarnStreamJson("stream-json", loadConfig().streamJsonAcknowledged)) {
2323
+ const verdict = await showStreamJsonWarning(ui);
2324
+ if (verdict === undefined) {
2325
+ ui.notify(`engine unchanged: ${current}.`, "info");
2326
+ return;
2327
+ }
2328
+ if (verdict === "keep") {
2329
+ saveConfig({ engine: "stream-json", streamJsonAcknowledged: true });
2330
+ ui.notify(streamJsonKeptMessage(), "warning");
2331
+ ui.notify("Takes effect on the next pi start (or /reload).", "info");
2332
+ return;
2333
+ }
2334
+ picked = "acp";
2335
+ }
2243
2336
  if (picked === "acp" && loadConfig().mode === "plan") {
2244
2337
  ui.notify("mode is plan; provider plan turns are disabled on ACP. /agy mode accept-edits first.", "warning");
2245
2338
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@estebanforge/pi-antigravity-bridge",
3
- "version": "1.16.1",
3
+ "version": "1.17.1",
4
4
  "description": "Gemini provider for Pi on the Antigravity ACP server (official Google ACP) or the stream-json agy CLI. Use antigravity/* models in Pi. Full /model picker support. Models runs Pi's tools. ToS safe to use.",
5
5
  "keywords": [
6
6
  "pi-package",
package/src/config.ts CHANGED
@@ -145,6 +145,12 @@ export interface AgyConfig {
145
145
  * on the installed pi. The notice never repeats; /agy patch-cleanup is
146
146
  * always available. */
147
147
  patchCleanupNotified?: boolean;
148
+ /** Consent record for the stream-json warning modal (google-antigravity/
149
+ * antigravity-cli#1890: 4x custom-agent quota rate on agy 1.5.17+, and the
150
+ * engine runs outside Google's sanctioned integration surface). Set when
151
+ * the user explicitly keeps stream-json or switches away; absent/false
152
+ * re-asks on the next TUI start. Never set by headless runs. */
153
+ streamJsonAcknowledged?: boolean;
148
154
  /** config.json values that were present but unparseable and fell back or
149
155
  * failed closed (issue #23). Surfaced by /agy doctor; undefined when
150
156
  * every value parsed. Computed per load, never persisted by saveConfig. */
@@ -543,6 +549,7 @@ export function loadConfig(configFile: string = configPath()): AgyConfig {
543
549
  agent,
544
550
  approvals: { gateMode, mode: gateAskMode },
545
551
  patchCleanupNotified: file.patchCleanupNotified === true,
552
+ streamJsonAcknowledged: file.streamJsonAcknowledged === true,
546
553
  parseWarnings: parseWarnings.length > 0 ? parseWarnings : undefined,
547
554
  };
548
555
  }
@@ -85,6 +85,58 @@ export function engineSettingsRow(engine: Engine): DialogRow {
85
85
  };
86
86
  }
87
87
 
88
+ /** Consent gate for the stream-json engine (google-antigravity/antigravity-cli#1890):
89
+ * the staged carrier rides `--agent`, so on agy 1.5.17+ its turns bill at
90
+ * Google's custom-agent quota rate, and the engine is not a sanctioned
91
+ * third-party integration surface (clause 6 of the Antigravity terms).
92
+ * The modal offers the switch to acp and records an explicit keep; esc
93
+ * decides later (re-asks next TUI start, same contract as the picker). */
94
+ export const STREAM_JSON_WARNING_INTRO = [
95
+ "The stream-json engine stages your system prompt as a custom --agent file. On agy 1.5.17 and later those turns bill at the custom-agent quota rate: 4× Gemini quota per token (google-antigravity/antigravity-cli#1890, closed as intentional).",
96
+ "",
97
+ "It is also not a Google-documented integration path for third-party clients. ACP (agy acp) is the documented, standard-rate path.",
98
+ ].join("\n");
99
+
100
+ export const SHOW_STREAM_JSON_WARNING_ITEMS: ChoiceOption[] = [
101
+ { value: "acp", label: "Switch to ACP (recommended)", description: "standard rate · Google's documented surface" },
102
+ { value: "keep", label: "Keep stream-json", description: "4× quota rate on agy 1.5.17+" },
103
+ ];
104
+
105
+ /** True when the engine in play is stream-json and the user has not yet made
106
+ * an explicit choice about it. */
107
+ export function shouldWarnStreamJson(engine: Engine, streamJsonAcknowledged?: boolean): boolean {
108
+ return engine === "stream-json" && !streamJsonAcknowledged;
109
+ }
110
+
111
+ /** One-line copy for surfaces without the modal (headless /agy engine) and
112
+ * for the keep verdict's toast. */
113
+ export function streamJsonKeptMessage(): string {
114
+ return "stream-json selected: turns bill at the 4× custom-agent quota rate on agy 1.5.17+ and this is not a Google-documented integration path (google-antigravity/antigravity-cli#1890).";
115
+ }
116
+
117
+ /** The saveConfig patch for an engine choice that went through the gate: the
118
+ * acknowledgment rides ONLY when the warning modal actually ran, so a bare
119
+ * `/agy engine acp` or a headless stream-json apply never records consent
120
+ * the user never gave (the next TUI start still asks). */
121
+ export function streamJsonSavePatch(
122
+ engine: Engine,
123
+ warned: boolean,
124
+ ): { engine: Engine; streamJsonAcknowledged?: true } {
125
+ return warned ? { engine, streamJsonAcknowledged: true } : { engine };
126
+ }
127
+
128
+ /** Resolves "acp" (switch), "keep" (explicit consent), or undefined (esc:
129
+ * decide later, nothing persisted). */
130
+ export async function showStreamJsonWarning(ctx: ExtensionUIContext): Promise<"acp" | "keep" | undefined> {
131
+ const picked = await dialogChoice(asDialogContext(ctx), "Antigravity Bridge: stream-json engine warning", {
132
+ description: STREAM_JSON_WARNING_INTRO,
133
+ options: SHOW_STREAM_JSON_WARNING_ITEMS,
134
+ footer: "↑↓ navigate · enter select · esc decide later",
135
+ });
136
+ if (picked === undefined) return undefined;
137
+ return picked === "keep" ? "keep" : "acp";
138
+ }
139
+
88
140
  /** Bare-name suffix candidates per platform. Windows pins the probe to
89
141
  * agy.exe: that is the only artifact Google ships there, and .bat/.cmd
90
142
  * cannot spawn anyway (shell:false + EINVAL since CVE-2024-27980). */