shariq-pi-extensions 0.2.2 → 0.2.4

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.
@@ -66,7 +66,12 @@ export default function antigravityProviderExtension(pi: ExtensionAPI) {
66
66
  models: ANTIGRAVITY_MODELS,
67
67
  oauth: {
68
68
  name: PROVIDER_NAME,
69
- login: loginAntigravity as any,
69
+ login: ((callbacks: Parameters<typeof loginAntigravity>[0]) => {
70
+ // Pi replaces its single stored provider credential after login. Archive
71
+ // the current account first so signing into another account cannot lose it.
72
+ migrateStoredCredential();
73
+ return loginAntigravity(callbacks);
74
+ }) as any,
70
75
  refreshToken: refreshAntigravityToken as any,
71
76
  getApiKey: getApiKey as any,
72
77
  },
@@ -480,7 +480,7 @@ export default function (pi: ExtensionAPI) {
480
480
  childCwd: cwd,
481
481
  parentTrusted: ctx.isProjectTrusted(),
482
482
  }),
483
- inheritedModel: ctx.model ? { provider: ctx.model.provider, id: ctx.model.id } : undefined,
483
+ inheritedModel: ctx.model ?? undefined,
484
484
  inheritedThinkingLevel: pi.getThinkingLevel(),
485
485
  inheritedMessages,
486
486
  parentSessionFile: ctx.sessionManager.getSessionFile(),
@@ -186,14 +186,17 @@ function createParentBridgeTools(task: SpawnTask): ToolDefinition[] {
186
186
  * then must be unambiguous across providers. No hint inherits the parent
187
187
  * model; with nothing to inherit, the SDK default applies.
188
188
  */
189
- function resolvePiModel(
189
+ export function resolvePiModel(
190
190
  registry: ModelRegistry,
191
191
  hint: string | undefined,
192
- inherited: { provider: string; id: string } | undefined,
192
+ inherited: Model<any> | undefined,
193
193
  ): Model<any> | undefined {
194
194
  if (!hint) {
195
195
  if (!inherited) return undefined;
196
- return registry.find(inherited.provider, inherited.id) ?? undefined;
196
+ return registry.find(inherited.provider, inherited.id) ?? inherited;
197
+ }
198
+ if (inherited?.id === hint) {
199
+ return registry.find(inherited.provider, hint) ?? inherited;
197
200
  }
198
201
  const slash = hint.indexOf("/");
199
202
  if (slash > 0) {
@@ -201,11 +204,13 @@ function resolvePiModel(
201
204
  const id = hint.slice(slash + 1);
202
205
  const found = registry.find(provider, id);
203
206
  if (found) return found;
207
+ if (inherited?.provider === provider && inherited.id === id) return inherited;
204
208
  throw new Error(`Unknown model "${hint}".`);
205
209
  }
206
210
  if (inherited) {
207
211
  const found = registry.find(inherited.provider, hint);
208
212
  if (found) return found;
213
+ if (inherited.id === hint) return inherited;
209
214
  }
210
215
  const matches = registry.getAll().filter((m) => m.id === hint);
211
216
  if (matches.length === 1) return matches[0];
@@ -6,7 +6,7 @@
6
6
  * `SubagentEvent` union.
7
7
  */
8
8
 
9
- import type { Message } from "@earendil-works/pi-ai";
9
+ import type { Message, Model } from "@earendil-works/pi-ai";
10
10
  import type { ModelRegistry } from "@earendil-works/pi-coding-agent";
11
11
  import { Data } from "effect";
12
12
  import type { CapabilityMode, IsolationMode } from "./config.ts";
@@ -50,7 +50,7 @@ export interface ParentContext {
50
50
  /** In-process bridge used by child-only message_parent/ask_parent tools. */
51
51
  readonly bridge?: ParentBridge;
52
52
  /** Parent pi model, for the pi backend's "inherit" default. */
53
- readonly inheritedModel?: { readonly provider: string; readonly id: string };
53
+ readonly inheritedModel?: Model<any>;
54
54
  readonly inheritedThinkingLevel?: string;
55
55
  /** Parent model registry; required by the pi backend to resolve models. */
56
56
  readonly modelRegistry?: ModelRegistry;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shariq-pi-extensions",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Cross-platform extension suite for the Pi coding agent.",
5
5
  "license": "MIT",
6
6
  "author": "Shariq Riaz",