@juanbenjumea/pi-agy 0.7.9 → 0.7.12

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.
@@ -93,9 +93,14 @@ export interface ProviderToolPark {
93
93
  args: Record<string, unknown>;
94
94
  }
95
95
 
96
+ /** A parked phase may publish only while its originating operation still owns it. */
97
+ export interface ProviderTurnOwnership {
98
+ assertValid: () => void;
99
+ }
100
+
96
101
  export type ProviderRunEnd =
97
102
  | { kind: "done"; result: ProviderTurnResult }
98
- | { kind: "parked"; park: ProviderToolPark };
103
+ | { kind: "parked"; park: ProviderToolPark; ownership?: ProviderTurnOwnership };
99
104
 
100
105
  export interface ProviderToolDelivery {
101
106
  callId: string;
@@ -116,7 +121,7 @@ export interface ProviderTurnRunner {
116
121
  signal?: AbortSignal,
117
122
  timeoutMs?: number,
118
123
  ) => Promise<ProviderRunEnd>;
119
- cancel: () => void;
124
+ cancel: (ownership?: ProviderTurnOwnership) => void;
120
125
  }
121
126
 
122
127
  export interface ProviderTurnResult {
@@ -144,87 +149,113 @@ export function getProviderRunner(dir: string): ProviderTurnRunner {
144
149
  const existing = providerRunners.get(key);
145
150
  if (existing) return existing;
146
151
  const driver = getProviderDriver(dir);
152
+ interface Operation extends ProviderTurnOwnership {
153
+ failure?: Error;
154
+ parks: Set<string>;
155
+ bridge?: McpBridgeHandle;
156
+ }
157
+ let operation: Operation | undefined;
158
+ const release = (owned: Operation, error: Error): void => {
159
+ owned.failure ??= error;
160
+ if (operation === owned) operation = undefined;
161
+ owned.bridge?.discardParks(owned.parks);
162
+ owned.parks.clear();
163
+ const stale = suspendedByDir.get(key);
164
+ if (stale?.ownership === owned) {
165
+ suspendedByDir.delete(key);
166
+ void runImageCleanups(stale.imageCleanups);
167
+ }
168
+ };
169
+ const finishPhase = (owned: Operation, end: Parameters<typeof toRunEnd>[0]): ProviderRunEnd => {
170
+ owned.assertValid();
171
+ const result = toRunEnd(end);
172
+ if (result.kind === "parked") return { ...result, ownership: owned };
173
+ release(owned, new Error("agy provider operation completed"));
174
+ return result;
175
+ };
147
176
  const runner: ProviderTurnRunner = {
148
177
  run: (request) => {
149
178
  const lockStart = Date.now();
150
- return withDirLock(
151
- request.dir,
152
- async () => {
179
+ return withDirLock(request.dir, async () => {
180
+ // Reserve before any await or bridge mutation. Resumes stay lock-free,
181
+ // so the workspace lock alone cannot protect this operation's catalog.
182
+ if (operation) throw new Error("another agy turn owns this driver (running or suspended awaiting Pi tools)");
183
+ const owned: Operation = {
184
+ parks: new Set(),
185
+ assertValid: () => { if (owned.failure) throw owned.failure; },
186
+ };
187
+ operation = owned;
188
+ try {
153
189
  const waited = Date.now() - lockStart;
154
190
  const remaining = Math.max(5_000, request.timeoutMs - waited);
155
- // Bridge startup never fails a turn: without a handle the driver
156
- // simply spawns plain and parks are refused at the bridge.
157
191
  const bridge = await ensureProviderBridge(request.dir).catch(() => undefined);
158
- // Process-stable staging root: agy can open staged images even
159
- // with permissions enforced (no per-turn fingerprint churn).
192
+ owned.bridge = bridge;
160
193
  const imageRoot = await ensureImageStagingRoot().catch(() => undefined);
194
+ owned.assertValid();
161
195
  const fingerprint = bridgeToolsFingerprint(request.bridgedTools);
196
+ driver.onParksOrphaned = (message) => {
197
+ bridge?.failAllParks(message);
198
+ // The latch also survives the gap before the stream publishes a
199
+ // suspension: a resolved parked phase cannot resurrect an orphan.
200
+ release(owned, new Error(message));
201
+ };
162
202
  if (bridge) {
163
203
  bridge.setTools(request.bridgedTools);
164
- bridge.setParkHandler((park) =>
165
- driver.notifyPark({ callId: park.callId, toolName: park.toolName, args: park.args }),
166
- );
167
- driver.onParksOrphaned = (message) => {
168
- bridge.failAllParks(message);
169
- // Abandoned suspensions (wall timer, teardown kills) reclaim
170
- // their staging here; nothing else will consume them.
171
- const stale = suspendedByDir.get(path.resolve(request.dir));
172
- if (stale) {
173
- suspendedByDir.delete(path.resolve(request.dir));
174
- void runImageCleanups(stale.imageCleanups);
175
- }
176
- };
204
+ bridge.setParkHandler((park) => {
205
+ if (owned.failure) return false;
206
+ owned.parks.add(park.callId);
207
+ const accepted = driver.notifyPark(park);
208
+ if (!accepted) owned.parks.delete(park.callId);
209
+ return accepted;
210
+ });
177
211
  }
178
- const end = await driver.turn(
179
- {
180
- dir: request.dir,
181
- fullModel: request.fullModel,
182
- effort: request.effort,
183
- skipPermissions: request.skipPermissions,
184
- bridgeDir: bridge?.configDir,
185
- bridgeTools: bridge ? fingerprint : undefined,
186
- imageRoot,
187
- },
188
- {
189
- prompt: request.prompt,
190
- resumeConversationId: request.resumeConversationId,
191
- signal: request.signal,
192
- timeoutMs: remaining,
193
- onText: request.callbacks?.onText,
194
- onActivity: request.callbacks?.onActivity,
195
- },
196
- );
197
- return toRunEnd(end);
198
- },
199
- request.signal,
200
- request.timeoutMs,
201
- );
212
+ const end = await driver.turn({
213
+ dir: request.dir, fullModel: request.fullModel, effort: request.effort,
214
+ skipPermissions: request.skipPermissions, bridgeDir: bridge?.configDir,
215
+ bridgeTools: bridge ? fingerprint : undefined, imageRoot,
216
+ }, {
217
+ prompt: request.prompt, resumeConversationId: request.resumeConversationId,
218
+ signal: request.signal, timeoutMs: remaining,
219
+ onText: request.callbacks?.onText, onActivity: request.callbacks?.onActivity,
220
+ });
221
+ return finishPhase(owned, end);
222
+ } catch (error) {
223
+ release(owned, error instanceof Error ? error : new Error(String(error)));
224
+ throw error;
225
+ }
226
+ }, request.signal, request.timeoutMs);
202
227
  },
203
228
  resume: async (deliveries, callbacks, resumeSignal, resumeTimeoutMs) => {
204
- // Deliberately lock-free: resume continues an already-running child
205
- // (no spawn) and taking the lock here deadlocks whenever the parked
206
- // tool call itself started a lock-holding background run — the resume
207
- // would wait on the very run it must complete to proceed. The
208
- // suspended-gap race this opens (a foreign delegation run editing
209
- // under a live provider child) is inherent to persistent processes;
210
- // same-directory concurrency stays the agent's to coordinate, and
211
- // fresh provider turns still serialize on the lock.
212
- const bridge = providerBridges.get(path.resolve(dir));
229
+ // Deliberately lock-free: a parked Pi tool may itself hold the workspace
230
+ // lock. Taking it here would wait on the work this resume must complete.
231
+ const owned = operation;
232
+ if (!owned) throw new Error("agy provider driver has no suspended operation");
233
+ owned.assertValid();
234
+ const bridge = owned.bridge;
213
235
  if (!bridge) throw new Error("agy provider turn has no bridge to resume on");
214
- for (const delivery of deliveries) {
215
- bridge.completePark(delivery.callId, { text: delivery.text, isError: delivery.isError });
236
+ if (!deliveries.length || deliveries.some((delivery) => !owned.parks.has(delivery.callId))) {
237
+ throw new Error("agy provider tool delivery does not belong to the suspended operation");
238
+ }
239
+ try {
240
+ for (const delivery of deliveries) {
241
+ bridge.completePark(delivery.callId, { text: delivery.text, isError: delivery.isError });
242
+ }
243
+ const end = await driver.continueTurn({
244
+ signal: resumeSignal, timeoutMs: resumeTimeoutMs,
245
+ onText: callbacks?.onText, onActivity: callbacks?.onActivity,
246
+ });
247
+ return finishPhase(owned, end);
248
+ } catch (error) {
249
+ release(owned, error instanceof Error ? error : new Error(String(error)));
250
+ throw error;
216
251
  }
217
- const end = await driver.continueTurn({
218
- signal: resumeSignal,
219
- timeoutMs: resumeTimeoutMs,
220
- onText: callbacks?.onText,
221
- onActivity: callbacks?.onActivity,
222
- });
223
- return toRunEnd(end);
224
252
  },
225
- cancel: () => {
253
+ cancel: (ownership) => {
254
+ const owned = operation;
255
+ if (!owned || (ownership && ownership !== owned)) return;
226
256
  driver.cancelSuspended("agy provider turn was cancelled");
227
- providerBridges.get(path.resolve(dir))?.failAllParks("agy provider turn was cancelled");
257
+ owned.bridge?.failAllParks("agy provider turn was cancelled");
258
+ release(owned, new Error("agy provider turn was cancelled"));
228
259
  },
229
260
  };
230
261
  providerRunners.set(key, runner);
@@ -327,7 +358,7 @@ export interface ProviderStatus {
327
358
  boundConversationId?: string;
328
359
  };
329
360
  /** Bridge description, when a bridge is running for the directory. */
330
- bridge?: { toolCount: number };
361
+ bridge?: { toolCount: number; pendingResults: number };
331
362
  /** Suspended turns awaiting Pi tool results. */
332
363
  suspended: ProviderStatusSuspended[];
333
364
  /** Live image staging dirs process-wide. */
@@ -364,7 +395,7 @@ export function getProviderStatus(dir: string): ProviderStatus {
364
395
  boundConversationId: snapshot.boundConversationId,
365
396
  }
366
397
  : undefined,
367
- bridge: bridge ? { toolCount: bridge.describe().toolCount } : undefined,
398
+ bridge: bridge ? { toolCount: bridge.describe().toolCount, pendingResults: bridge.describe().pendingResults } : undefined,
368
399
  suspended,
369
400
  stagedImages: getLiveImageStagingCount(),
370
401
  };
@@ -430,7 +461,7 @@ export function resolveProviderTurnModel(
430
461
  const entry = entries.find((candidate) => candidate.id === modelId);
431
462
  if (!entry) {
432
463
  throw new Error(
433
- `Unknown ${AGY_PROVIDER_ID} model '${modelId}'; pick another via /model (the agy catalog may have changed — restart Pi to refresh).`,
464
+ `Unknown ${AGY_PROVIDER_ID} model '${modelId}'; pick another via /model (the agy catalog may have changed — reopen /model to refresh).`,
434
465
  );
435
466
  }
436
467
  const effort =
@@ -491,6 +522,7 @@ function hasUserMessageAfterToolCall(messages: ProviderTranscriptMessage[], tool
491
522
 
492
523
  interface SuspendedTurn {
493
524
  runner: ProviderTurnRunner;
525
+ ownership?: ProviderTurnOwnership;
494
526
  toolCallId: string;
495
527
  park: ProviderToolPark;
496
528
  modelId: string;
@@ -648,6 +680,7 @@ export function createAgyStreamSimple(
648
680
  const bodies = prior ? collectParkedDeliveries(messages, prior.toolCallId) : [];
649
681
  let end: ProviderRunEnd;
650
682
  if (prior && bodies.length > 0) {
683
+ prior.ownership?.assertValid();
651
684
  suspendedByDir.delete(skey);
652
685
  // Images riding on the delivered tool results are staged too:
653
686
  // the resumed agy turn reads them by path. Owned by this
@@ -677,7 +710,7 @@ export function createAgyStreamSimple(
677
710
  // The suspended turn is gone (agy moved on without us): fail the
678
711
  // parks so nothing strands, then surface the failure loudly.
679
712
  try {
680
- runner.cancel();
713
+ runner.cancel(prior.ownership);
681
714
  } catch {
682
715
  // Cancel is best effort next to the real error.
683
716
  }
@@ -694,7 +727,7 @@ export function createAgyStreamSimple(
694
727
  // of bricking the directory behind the suspended guard.
695
728
  suspendedByDir.delete(skey);
696
729
  try {
697
- runner.cancel();
730
+ runner.cancel(prior.ownership);
698
731
  } catch {
699
732
  // Cancel is best effort next to a fresh turn.
700
733
  }
@@ -727,7 +760,7 @@ export function createAgyStreamSimple(
727
760
  timeoutMs: deps.timeoutMs ?? PROVIDER_TURN_TIMEOUT_MS,
728
761
  resumeConversationId: resume,
729
762
  skipPermissions: deps.skipPermissions ?? true,
730
- bridgedTools: projectBridgeTools(deps.tools ?? []),
763
+ bridgedTools: projectBridgeTools(options?.tools ?? deps.tools ?? []),
731
764
  callbacks,
732
765
  });
733
766
  }
@@ -752,17 +785,15 @@ export function createAgyStreamSimple(
752
785
  name: end.park.toolName,
753
786
  arguments: end.park.args,
754
787
  };
788
+ end.ownership?.assertValid();
789
+ suspendedByDir.set(skey, {
790
+ runner, ownership: end.ownership, toolCallId, park: end.park,
791
+ modelId: model.id, imageCleanups: pendingImageCleanups,
792
+ });
755
793
  output.content.push(toolCall);
756
794
  const toolIndex = output.content.length - 1;
757
795
  stream.push({ type: "toolcall_start", contentIndex: toolIndex, partial: output });
758
796
  stream.push({ type: "toolcall_end", contentIndex: toolIndex, toolCall, partial: output });
759
- suspendedByDir.set(skey, {
760
- runner,
761
- toolCallId,
762
- park: end.park,
763
- modelId: model.id,
764
- imageCleanups: pendingImageCleanups,
765
- });
766
797
  output.usage.totalTokens =
767
798
  output.usage.input + output.usage.output + output.usage.cacheRead + output.usage.cacheWrite;
768
799
  output.stopReason = "toolUse";
@@ -776,27 +807,20 @@ export function createAgyStreamSimple(
776
807
  const thinking = (output.content[thinkingIndex] as { thinking: string }).thinking;
777
808
  stream.push({ type: "thinking_end", contentIndex: thinkingIndex, content: thinking, partial: output });
778
809
  }
779
- if (textIndex === -1) {
780
- // No live deltas arrived: the terminal response (if any) is the
781
- // answer — never answer empty when agy produced text.
782
- const index = ensureText();
783
- const fallback =
784
- result.text ||
785
- (result.activity.length > 0 ? result.activity.join("\n") : "(agy returned no text)");
786
- (output.content[index] as { text: string }).text = fallback;
787
- stream.push({ type: "text_end", contentIndex: index, content: fallback, partial: output });
788
- } else {
789
- const block = output.content[textIndex];
790
- let finalText = (block as { text: string }).text;
791
- if (result.truncated) finalText += "\n\n[truncated: agy response exceeded the provider cap]";
792
- if (result.deniedActions && result.deniedActions.length > 0) {
793
- finalText += `\n\n[warning: agy reported ${result.deniedActions.length} denied action(s) alongside this response]`;
794
- }
795
- if (result.aborted) finalText += "\n\n[note: turn cancelled — response is partial]";
796
- else if (result.timedOut) finalText += "\n\n[note: turn timed out — response is partial]";
797
- (block as { text: string }).text = finalText;
798
- stream.push({ type: "text_end", contentIndex: textIndex, content: finalText, partial: output });
810
+ const index = textIndex === -1 ? ensureText() : textIndex;
811
+ const block = output.content[index] as { text: string };
812
+ // The terminal result is authoritative; activity and the empty-result
813
+ // fallback supply content only when that result has no answer.
814
+ let finalText = result.text ||
815
+ (result.activity.length > 0 ? result.activity.join("\n") : "(agy returned no text)");
816
+ if (result.truncated) finalText += "\n\n[truncated: agy response exceeded the provider cap]";
817
+ if (result.deniedActions && result.deniedActions.length > 0) {
818
+ finalText += `\n\n[warning: agy reported ${result.deniedActions.length} denied action(s) alongside this response]`;
799
819
  }
820
+ if (result.aborted) finalText += "\n\n[note: turn cancelled — response is partial]";
821
+ else if (result.timedOut) finalText += "\n\n[note: turn timed out — response is partial]";
822
+ block.text = finalText;
823
+ stream.push({ type: "text_end", contentIndex: index, content: finalText, partial: output });
800
824
 
801
825
  output.usage.totalTokens = output.usage.input + output.usage.output + output.usage.cacheRead + output.usage.cacheWrite;
802
826
  // Partial turns must never masquerade as clean stops: surface the
@@ -0,0 +1,25 @@
1
+ /** Pure interpretation of the public conversation-selection flags. */
2
+ export type ConversationSelection =
3
+ | { kind: "new" }
4
+ | { kind: "latest"; source: "cli" | "recorded" }
5
+ | { kind: "resume"; id: string };
6
+
7
+ export interface ConversationFlags {
8
+ conversation_id?: string;
9
+ continue?: boolean;
10
+ new_session?: boolean;
11
+ }
12
+
13
+ export function normalizeConversationSelection(flags: ConversationFlags): ConversationSelection {
14
+ // Empty IDs have always behaved like an omitted ID; do not trim or coerce.
15
+ if (flags.continue && flags.conversation_id) {
16
+ throw new Error("agy cannot use --continue and --conversation together");
17
+ }
18
+ if (flags.new_session === true && (flags.continue || flags.conversation_id)) {
19
+ throw new Error("agy new_session cannot be combined with a conversation to resume");
20
+ }
21
+ if (flags.conversation_id) return { kind: "resume", id: flags.conversation_id };
22
+ if (flags.continue) return { kind: "latest", source: "cli" };
23
+ if (flags.new_session === false) return { kind: "latest", source: "recorded" };
24
+ return { kind: "new" };
25
+ }
@@ -43,13 +43,17 @@ export function appendBounded(chunks: Buffer[], total: number, data: Buffer): nu
43
43
  * modifying files after Pi reported cancellation.
44
44
  */
45
45
  export function killProcessTree(child: ChildProcess): void {
46
+ const groupPid = process.platform !== "win32" && child.pid ? -child.pid : undefined;
46
47
  try {
47
- if (child.exitCode !== null || child.signalCode !== null) return;
48
- if (child.pid && process.platform !== "win32") {
48
+ // A leader can exit while a descendant remains in its process group.
49
+ // Leader lifecycle is therefore not evidence that the group is gone.
50
+ if (!groupPid && (child.exitCode !== null || child.signalCode !== null)) return;
51
+ if (groupPid !== undefined) {
49
52
  try {
50
- process.kill(-child.pid, "SIGTERM");
51
- } catch {
52
- child.kill("SIGTERM");
53
+ process.kill(groupPid, "SIGTERM");
54
+ } catch (error) {
55
+ if ((error as NodeJS.ErrnoException).code === "ESRCH") return;
56
+ throw error;
53
57
  }
54
58
  } else {
55
59
  child.kill("SIGTERM");
@@ -59,15 +63,13 @@ export function killProcessTree(child: ChildProcess): void {
59
63
  }
60
64
  const escalate = setTimeout(() => {
61
65
  try {
62
- if (child.exitCode === null && child.signalCode === null) {
63
- if (child.pid && process.platform !== "win32") {
64
- try {
65
- process.kill(-child.pid, "SIGKILL");
66
- return;
67
- } catch {
68
- // Fall through to direct kill.
69
- }
66
+ if (groupPid !== undefined) {
67
+ try {
68
+ process.kill(groupPid, "SIGKILL");
69
+ } catch (error) {
70
+ if ((error as NodeJS.ErrnoException).code !== "ESRCH") throw error;
70
71
  }
72
+ } else if (child.exitCode === null && child.signalCode === null) {
71
73
  child.kill("SIGKILL");
72
74
  }
73
75
  } catch {
@@ -1,9 +1,10 @@
1
1
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
- import { Type } from "@sinclair/typebox";
2
+ import { Type, type SchemaOptions } from "@sinclair/typebox";
3
3
  import { stat } from "node:fs/promises";
4
4
  import * as path from "node:path";
5
5
 
6
6
  import {
7
+ AGY_MODEL_ALIASES,
7
8
  checkAgyUsage,
8
9
  findAgyQuotaEntries,
9
10
  formatAgyUsage,
@@ -31,6 +32,7 @@ import { describeWhen, truncate } from "./lib/output.js";
31
32
  import { BackgroundTaskRunner, summarizeTaskPrompt } from "./lib/background.js";
32
33
  import { renderAgyCall, renderAgyResult } from "./lib/render.js";
33
34
  import { getHistory, getSession } from "./lib/sessions.js";
35
+ import { normalizeConversationSelection } from "./lib/request.js";
34
36
 
35
37
  async function resolveToolDir(cwd: string, dir?: string): Promise<string> {
36
38
  const resolved = dir ? path.resolve(cwd, dir) : cwd;
@@ -58,6 +60,10 @@ export function getBackgroundRunner(): BackgroundTaskRunner {
58
60
  return backgroundRunner;
59
61
  }
60
62
 
63
+ function modelAliasSchema(options: SchemaOptions) {
64
+ return Type.Union(AGY_MODEL_ALIASES.map((alias) => Type.Literal(alias)), options);
65
+ }
66
+
61
67
  export function registerAgyTools(pi: ExtensionAPI): void {
62
68
  pi.registerTool({
63
69
  name: "agy_execute",
@@ -78,19 +84,7 @@ export function registerAgyTools(pi: ExtensionAPI): void {
78
84
  minLength: 1,
79
85
  }),
80
86
  model: Type.Optional(
81
- Type.Union(
82
- [
83
- Type.Literal("flash-low"),
84
- Type.Literal("flash-medium"),
85
- Type.Literal("flash-high"),
86
- Type.Literal("pro-low"),
87
- Type.Literal("pro-high"),
88
- Type.Literal("sonnet"),
89
- Type.Literal("opus"),
90
- Type.Literal("gpt-oss"),
91
- ],
92
- { description: "Model alias. Defaults to 'flash-medium'.", default: "flash-medium" },
93
- ),
87
+ modelAliasSchema({ description: "Model alias. Defaults to 'flash-medium'.", default: "flash-medium" }),
94
88
  ),
95
89
  effort: Type.Optional(
96
90
  Type.Union([Type.Literal("low"), Type.Literal("medium"), Type.Literal("high")], {
@@ -183,12 +177,13 @@ export function registerAgyTools(pi: ExtensionAPI): void {
183
177
  const mode = resolveAgyMode(params.mode);
184
178
  const model = params.model as AgyModel | undefined;
185
179
  const contextMode = (params.context ?? "none") as AgyContextMode;
180
+ const selection = normalizeConversationSelection(params);
186
181
  let agent = normalizeAgyAgentName(params.agent);
187
- if (!agent && params.conversation_id) {
182
+ if (!agent && selection.kind === "resume") {
188
183
  agent = (await getHistory(cwd)).find(
189
- (entry) => entry.conversation_id === params.conversation_id,
184
+ (entry) => entry.conversation_id === selection.id,
190
185
  )?.agent;
191
- } else if (!agent && (params.continue || params.new_session === false)) {
186
+ } else if (!agent && selection.kind === "latest") {
192
187
  const storedAgent = (await getSession(cwd))?.last_agent;
193
188
  try {
194
189
  agent = normalizeAgyAgentName(storedAgent);
@@ -196,9 +191,7 @@ export function registerAgyTools(pi: ExtensionAPI): void {
196
191
  // Ignore malformed legacy session metadata.
197
192
  }
198
193
  }
199
- const isResume = Boolean(
200
- params.conversation_id || params.continue || params.new_session === false,
201
- );
194
+ const isResume = selection.kind !== "new";
202
195
  const effectiveContextMode = effectiveResumeContextMode(contextMode, isResume);
203
196
  const contextText =
204
197
  effectiveContextMode === "none"
@@ -459,7 +452,7 @@ export function registerAgyTools(pi: ExtensionAPI): void {
459
452
  const outcome = task.state === "running"
460
453
  ? ""
461
454
  : task.state === "done"
462
- ? `\nresult: ${truncate(task.text ?? "(empty response)")}`
455
+ ? "\nResult ready; use agy_tasks collect to retrieve it."
463
456
  : `\n${task.state}${task.error ? `: ${task.error}` : ""}`;
464
457
  const conversation = task.conversationId ? `\nconversation: ${task.conversationId}` : "";
465
458
  return {
@@ -505,19 +498,7 @@ export function registerAgyTools(pi: ExtensionAPI): void {
505
498
  promptSnippet: "Inspect Antigravity model quotas before choosing a model",
506
499
  parameters: Type.Object({
507
500
  model: Type.Optional(
508
- Type.Union(
509
- [
510
- Type.Literal("flash-low"),
511
- Type.Literal("flash-medium"),
512
- Type.Literal("flash-high"),
513
- Type.Literal("pro-low"),
514
- Type.Literal("pro-high"),
515
- Type.Literal("sonnet"),
516
- Type.Literal("opus"),
517
- Type.Literal("gpt-oss"),
518
- ],
519
- { description: "Optional model alias to place first in the report." },
520
- ),
501
+ modelAliasSchema({ description: "Optional model alias to place first in the report." }),
521
502
  ),
522
503
  dir: Type.Optional(
523
504
  Type.String({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juanbenjumea/pi-agy",
3
- "version": "0.7.9",
3
+ "version": "0.7.12",
4
4
  "description": "Antigravity (agy) provider and delegation for Pi — /model picker, background tasks, loopback MCP tool bridge, quota awareness, and repo verification.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -55,9 +55,9 @@
55
55
  "@sinclair/typebox": "*"
56
56
  },
57
57
  "devDependencies": {
58
- "@earendil-works/pi-ai": "^0.87.1",
59
- "@earendil-works/pi-coding-agent": "^0.87.1",
60
- "@earendil-works/pi-tui": "^0.87.1",
58
+ "@earendil-works/pi-ai": "1.5.2",
59
+ "@earendil-works/pi-coding-agent": "1.5.2",
60
+ "@earendil-works/pi-tui": "1.5.2",
61
61
  "@sinclair/typebox": "^0.34.41",
62
62
  "@types/node": "^22.20.4",
63
63
  "typescript": "^5.0.0"
@@ -66,6 +66,6 @@
66
66
  "node": ">=20.3.0"
67
67
  },
68
68
  "dependencies": {
69
- "@modelcontextprotocol/sdk": "^1.31.0"
69
+ "@modelcontextprotocol/sdk": "^1.32.2"
70
70
  }
71
71
  }