Merge pull request #2566 from jeremymcs/fix/hydrate-remote-tokens-esm

fix(remote-questions): use static ESM import for AuthStorage hydration
This commit is contained in:
TÂCHES 2026-03-25 22:14:56 -06:00 committed by GitHub
commit 874df9bc43

View file

@ -2,7 +2,7 @@
* Remote Questions configuration resolution and validation
*/
import { join } from "node:path";
import { AuthStorage } from "@gsd/pi-coding-agent";
import { loadEffectiveGSDPreferences, type RemoteQuestionsConfig } from "../gsd/preferences.js";
import type { RemoteChannel } from "./types.js";
@ -54,9 +54,7 @@ function hydrateRemoteTokensFromAuth(): void {
if (needed.length === 0) return;
try {
const { AuthStorage } = require("@gsd/pi-coding-agent") as typeof import("@gsd/pi-coding-agent");
const authPath = join(process.env.HOME ?? "~", ".gsd", "agent", "auth.json");
const auth = AuthStorage.create(authPath);
const auth = AuthStorage.create();
for (const [providerId, envVar] of needed) {
try {
@ -72,7 +70,7 @@ function hydrateRemoteTokensFromAuth(): void {
}
}
} catch {
// AuthStorage unavailable (unit tests, stripped build) — skip silently.
// AuthStorage unavailable or auth.json missing/unreadable — skip silently.
}
}