fix(runtime): align supported requirements and release hygiene

This commit is contained in:
Federico Jaramillo Martinez
2026-07-18 00:10:47 +02:00
parent 1f13bab58a
commit aca168a311
21 changed files with 77 additions and 1204 deletions
+3 -2
View File
@@ -5,7 +5,7 @@ import { ModelRuntime } from "@earendil-works/pi-coding-agent";
import { InMemoryCredentialStore, type AuthPrompt, type Credential } from "@earendil-works/pi-ai";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { OAuthFlowState } from "../../shared/apiTypes.js";
import { AuthService, type AuthChange, type AuthServiceLogger } from "./authService.js";
import { AuthService, createModelRuntimeForAgentDir, type AuthChange, type AuthServiceLogger } from "./authService.js";
import { OAuthLoginFlowService } from "./oauthLoginFlowService.js";
const tempDirs: string[] = [];
@@ -251,7 +251,8 @@ describe("AuthService", () => {
it("stores credentials in the configured agent directory", async () => {
const agentDir = await tempAgentDir();
const auth = await AuthService.create({ agentDir });
const runtime = await createModelRuntimeForAgentDir(agentDir, false);
const auth = await AuthService.create({ runtime });
await auth.saveApiKey("anthropic", "sk-test");
+6 -2
View File
@@ -31,8 +31,12 @@ interface AuthChangeContext {
const noopLogger: AuthServiceLogger = { error() { /* no-op */ } };
export function createModelRuntimeForAgentDir(agentDir: string): Promise<ModelRuntime> {
return ModelRuntime.create({ authPath: join(agentDir, "auth.json"), modelsPath: join(agentDir, "models.json") });
export function createModelRuntimeForAgentDir(agentDir: string, allowModelNetwork?: boolean): Promise<ModelRuntime> {
return ModelRuntime.create({
authPath: join(agentDir, "auth.json"),
modelsPath: join(agentDir, "models.json"),
...(allowModelNetwork === undefined ? {} : { allowModelNetwork }),
});
}
export class AuthService {
@@ -79,7 +79,7 @@ export async function seedCredential(store: InMemoryCredentialStore, providerId:
* behavior (e.g. auth-loss warnings).
*/
export function createTestModelRuntime(credentials: CredentialStore = new InMemoryCredentialStore()): Promise<ModelRuntime> {
return ModelRuntime.create({ credentials });
return ModelRuntime.create({ credentials, modelsPath: null, allowModelNetwork: false });
}
/**