@juanbenjumea/pi-agy 0.7.0 → 0.7.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/CHANGELOG.md +12 -0
- package/README.md +2 -1
- package/extensions/commands.ts +53 -0
- package/extensions/lib/config.ts +24 -1
- package/extensions/lib/provider.ts +29 -5
- package/extensions/lib/spawn.ts +10 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.2
|
|
4
|
+
|
|
5
|
+
- Resolve stderr text when a successful run leaves stdout empty or whitespace-only (ported from upstream 0.3.8/0.3.9), after the terminal-status and permission-denial fail-closed checks so those semantics stand; stdout responses still win over stderr diagnostics.
|
|
6
|
+
- Cover symlink canonicalization into one directory-lock chain (our answer to upstream 0.3.6's symlink-escape rejection: resolve, don't reject).
|
|
7
|
+
- Full 280-test gate plus typecheck and package checks pass.
|
|
8
|
+
|
|
9
|
+
## 0.7.1
|
|
10
|
+
|
|
11
|
+
- Report provider runtime state in `/agy doctor` (driver turns/reuses/recycles, bridge tool count, suspended turns awaiting Pi tools, live image staging) via a never-throwing status snapshot.
|
|
12
|
+
- Add `/agy bridge [on|off|status]`: inspect or toggle the provider MCP bridge at runtime, persisted to `agy-config.json` with memoized servers invalidated so the next turn picks it up.
|
|
13
|
+
- Full 277-test gate plus typecheck and package checks pass.
|
|
14
|
+
|
|
3
15
|
## 0.7.0
|
|
4
16
|
|
|
5
17
|
- Register an `antigravity` provider so agy-backed models appear in Pi's global `/model` picker as `antigravity/*`, discovered from live `agy models` with a fallback catalog (background refresh, no `/reload`). Gemini bases expose Pi's thinking toggle as agy `--effort` clamped to supported tiers; fixed-thinking families keep agy's exact slug.
|
package/README.md
CHANGED
|
@@ -192,8 +192,9 @@ Run agy directly from the Pi TUI — fast path when fully specified, wizard othe
|
|
|
192
192
|
/agy continue fix the tests # continue this directory's last conversation
|
|
193
193
|
/agy timeout=10m sonnet big task # raise the run cap (also 90s / 1500ms; bare = minutes)
|
|
194
194
|
/agy sessions # pick a recorded conversation to resume
|
|
195
|
-
/agy doctor # diagnose CLI, models, agents, quota, config, sessions, lock, and repo gate
|
|
195
|
+
/agy doctor # diagnose CLI, models, agents, quota, config, sessions, lock, provider, and repo gate
|
|
196
196
|
/agy usage # inspect model quotas and reset times
|
|
197
|
+
/agy bridge [on|off] # inspect or toggle the provider MCP bridge (takes effect next turn)
|
|
197
198
|
```
|
|
198
199
|
|
|
199
200
|
Leading option tokens (`plan`, a model alias, `agent=name`, `continue`,
|
package/extensions/commands.ts
CHANGED
|
@@ -23,6 +23,8 @@ import { getHistory, getSession } from "./lib/sessions.js";
|
|
|
23
23
|
|
|
24
24
|
import { DEFAULT_TIMEOUT_MS, MODEL_ALIASES, MODEL_KEYS, MODE_KEYS, parseAgyCommandArgs } from "./lib/command-args.js";
|
|
25
25
|
import { buildAcceptEditsConfirm } from "./lib/confirm.js";
|
|
26
|
+
import { loadAgyConfig, saveAgyConfig } from "./lib/config.js";
|
|
27
|
+
import { describeProviderBridges, resetProviderBridges } from "./lib/provider.js";
|
|
26
28
|
|
|
27
29
|
const MODEL_OPTIONS = [
|
|
28
30
|
"flash — fast, cheap (Gemini Flash medium)",
|
|
@@ -110,6 +112,7 @@ export function registerAgyCommand(pi: ExtensionAPI): void {
|
|
|
110
112
|
"doctor",
|
|
111
113
|
"usage",
|
|
112
114
|
"quota",
|
|
115
|
+
"bridge",
|
|
113
116
|
"context=summary",
|
|
114
117
|
"context=recent",
|
|
115
118
|
"timeout=10m",
|
|
@@ -161,6 +164,11 @@ export function registerAgyCommand(pi: ExtensionAPI): void {
|
|
|
161
164
|
await showUsage(ctx, requestedModel);
|
|
162
165
|
return;
|
|
163
166
|
}
|
|
167
|
+
const bridgeMatch = /^bridge(?:\s+(\S+))?$/.exec(command);
|
|
168
|
+
if (bridgeMatch) {
|
|
169
|
+
await showBridge(ctx, bridgeMatch[1]);
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
164
172
|
|
|
165
173
|
const parsed = parseAgyCommandArgs(args);
|
|
166
174
|
if (parsed.error) {
|
|
@@ -280,6 +288,51 @@ async function showUsage(
|
|
|
280
288
|
}
|
|
281
289
|
}
|
|
282
290
|
|
|
291
|
+
/** `/agy bridge [on|off|status]` — inspect or toggle the provider MCP bridge. */
|
|
292
|
+
async function showBridge(ctx: ExtensionCommandContext, arg?: string): Promise<void> {
|
|
293
|
+
const sub = (arg ?? "status").toLowerCase();
|
|
294
|
+
if (sub !== "on" && sub !== "off" && sub !== "status") {
|
|
295
|
+
ctx.ui.notify("agy: bridge takes on, off, or no argument (status)", "error");
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
try {
|
|
299
|
+
await ctx.waitForIdle();
|
|
300
|
+
if (sub === "on" || sub === "off") {
|
|
301
|
+
ctx.ui.setStatus("agy", `agy: turning the provider bridge ${sub}…`);
|
|
302
|
+
await saveAgyConfig({ providerBridge: sub === "on" });
|
|
303
|
+
// Drop memoized servers so the next provider turn re-resolves;
|
|
304
|
+
// drivers recycle on the bridge-dir change by themselves.
|
|
305
|
+
await resetProviderBridges();
|
|
306
|
+
ctx.ui.notify(
|
|
307
|
+
sub === "on"
|
|
308
|
+
? "Provider bridge on: agy turns get Pi tools via localhost MCP (takes effect on the next turn)."
|
|
309
|
+
: "Provider bridge off: agy turns run plain (takes effect on the next turn).",
|
|
310
|
+
"info",
|
|
311
|
+
);
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
314
|
+
const config = await loadAgyConfig().catch(() => ({ providerBridge: true as const }));
|
|
315
|
+
const enabled = config.providerBridge !== false;
|
|
316
|
+
const bridges = describeProviderBridges();
|
|
317
|
+
const running = bridges.filter((bridge) => bridge.running);
|
|
318
|
+
const lines = [
|
|
319
|
+
`Provider bridge: ${enabled ? "on" : "off"} (agy-config.json${enabled ? "" : " — set providerBridge or run /agy bridge on"})`,
|
|
320
|
+
running.length > 0
|
|
321
|
+
? `running servers (${running.length}):\n${running.map((bridge) => `- ${bridge.dir} · ${bridge.toolCount ?? 0} tools`).join("\n")}`
|
|
322
|
+
: "no bridge servers running (one starts on the next provider turn)",
|
|
323
|
+
];
|
|
324
|
+
ctx.ui.notify(lines.join("\n"), "info");
|
|
325
|
+
} catch (error) {
|
|
326
|
+
if (ctx.signal?.aborted) ctx.ui.notify("agy: bridge check cancelled", "info");
|
|
327
|
+
else {
|
|
328
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
329
|
+
ctx.ui.notify(`agy bridge failed: ${message}`, "error");
|
|
330
|
+
}
|
|
331
|
+
} finally {
|
|
332
|
+
ctx.ui.setStatus("agy", undefined);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
283
336
|
/** `/agy sessions` — pick a recorded conversation and resume it with a follow-up. */
|
|
284
337
|
async function runSessionsPicker(
|
|
285
338
|
pi: ExtensionAPI,
|
package/extensions/lib/config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFile } from "node:child_process";
|
|
2
|
-
import { readFile } from "node:fs/promises";
|
|
2
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import * as os from "node:os";
|
|
4
4
|
import * as path from "node:path";
|
|
5
5
|
import { promisify } from "node:util";
|
|
@@ -99,6 +99,29 @@ export async function loadAgyConfig(
|
|
|
99
99
|
return {};
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
+
/**
|
|
103
|
+
* Persist config overrides, preserving unknown keys. Malformed existing
|
|
104
|
+
* files are replaced (the caller just made an explicit choice).
|
|
105
|
+
*/
|
|
106
|
+
export async function saveAgyConfig(
|
|
107
|
+
patch: Partial<AgyConfig>,
|
|
108
|
+
configPath = getDefaultConfigPath(),
|
|
109
|
+
): Promise<void> {
|
|
110
|
+
let base: Record<string, unknown> = {};
|
|
111
|
+
try {
|
|
112
|
+
const parsed: unknown = JSON.parse(await readFile(configPath, { encoding: "utf8" }));
|
|
113
|
+
if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) {
|
|
114
|
+
base = parsed as Record<string, unknown>;
|
|
115
|
+
}
|
|
116
|
+
} catch {
|
|
117
|
+
// Missing or corrupt: start fresh with the patch.
|
|
118
|
+
}
|
|
119
|
+
await mkdir(path.dirname(configPath), { recursive: true });
|
|
120
|
+
await writeFile(configPath, JSON.stringify({ ...base, ...patch }, null, 2) + "\n", {
|
|
121
|
+
encoding: "utf8",
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
|
|
102
125
|
const cachedCommandAliases = new Map<string, { at: number; alias?: AgyModel }>();
|
|
103
126
|
|
|
104
127
|
/**
|
|
@@ -594,6 +594,34 @@ async function ensureProviderBridge(dir: string): Promise<McpBridgeHandle | unde
|
|
|
594
594
|
|
|
595
595
|
const providerRunners = new Map<string, ProviderTurnRunner>();
|
|
596
596
|
|
|
597
|
+
/** Stop memoized bridges so the next turn re-resolves them (toggle support). */
|
|
598
|
+
export async function resetProviderBridges(): Promise<void> {
|
|
599
|
+
const bridges = [...providerBridges.values()];
|
|
600
|
+
providerBridges.clear();
|
|
601
|
+
await Promise.all(
|
|
602
|
+
bridges.map((bridge) => bridge?.stop().catch(() => undefined)),
|
|
603
|
+
);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
export interface ProviderBridgeStatus {
|
|
607
|
+
dir: string;
|
|
608
|
+
running: boolean;
|
|
609
|
+
toolCount?: number;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/** Point-in-time bridge states for status surfaces. Never throws. */
|
|
613
|
+
export function describeProviderBridges(): ProviderBridgeStatus[] {
|
|
614
|
+
const out: ProviderBridgeStatus[] = [];
|
|
615
|
+
try {
|
|
616
|
+
for (const [dir, bridge] of providerBridges) {
|
|
617
|
+
out.push({ dir, running: !!bridge, toolCount: bridge?.describe().toolCount });
|
|
618
|
+
}
|
|
619
|
+
} catch {
|
|
620
|
+
// Status surfaces must never break callers.
|
|
621
|
+
}
|
|
622
|
+
return out;
|
|
623
|
+
}
|
|
624
|
+
|
|
597
625
|
export interface ProviderStatusSuspended {
|
|
598
626
|
toolCallId: string;
|
|
599
627
|
toolName: string;
|
|
@@ -665,12 +693,8 @@ export async function closeProviderDrivers(): Promise<void> {
|
|
|
665
693
|
providerRunners.clear();
|
|
666
694
|
clearSuspendedTurns();
|
|
667
695
|
await clearImageStaging();
|
|
668
|
-
const bridges = [...providerBridges.values()];
|
|
669
|
-
providerBridges.clear();
|
|
670
696
|
await Promise.all(drivers.map((driver) => driver.close()));
|
|
671
|
-
await
|
|
672
|
-
bridges.map((bridge) => bridge?.stop().catch(() => undefined)),
|
|
673
|
-
);
|
|
697
|
+
await resetProviderBridges();
|
|
674
698
|
}
|
|
675
699
|
|
|
676
700
|
export interface AgyProviderStreamDeps {
|
package/extensions/lib/spawn.ts
CHANGED
|
@@ -364,6 +364,16 @@ function spawnAgyInternal(
|
|
|
364
364
|
if (stdoutTruncated && !finalized.response_complete) {
|
|
365
365
|
finalized.response += `\n\n(raw stdout capture was truncated at the ${MAX_CAPTURE_BYTES / 1024} KB fallback bound)`;
|
|
366
366
|
}
|
|
367
|
+
// Upstream 0.3.8/0.3.9: success resolves stdout-only, except a
|
|
368
|
+
// stray newline on stdout with the real message on stderr resolves
|
|
369
|
+
// with the stderr text instead of near-empty output. Runs after
|
|
370
|
+
// the denied/terminal checks so those fail-closed semantics stand.
|
|
371
|
+
// Stderr stays bounded by the capture above.
|
|
372
|
+
const responseText = finalized.response.trim();
|
|
373
|
+
if ((responseText === "" || responseText === "(empty response)") && err.trim()) {
|
|
374
|
+
finalized.response = err.trim();
|
|
375
|
+
finalized.response_complete = true;
|
|
376
|
+
}
|
|
367
377
|
resolve(finalized);
|
|
368
378
|
});
|
|
369
379
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juanbenjumea/pi-agy",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Reliable Antigravity delegation for Pi — quota-aware runs, resumable tasks, repo verification, cancellation, and trustworthy diff summaries.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|