refactor(auth-storage): cleanup auth.json mentions
- Migrated authentication storage from JSON-based (auth.json) to database-based (agent.db) format across test files and configuration. - Simplified auth storage discovery in sdk.ts by removing manual path construction and fallback logic in favor of centralized getAgentDbPath() function. - Removed dbPath instance property from AuthStorage class as database path is now managed centrally. - Updated environment variable precedence documentation to reflect agent.db instead of auth.json as the lowest priority source. - Removed OAuth provider section header comments from multiple test files for cleaner test organization. - Added support for JSON and JSONC configuration file formats without requiring migration to YAML.
This commit is contained in:
@@ -12,7 +12,7 @@ import {
|
||||
SessionManager,
|
||||
} from "@oh-my-pi/pi-coding-agent";
|
||||
|
||||
// Default: discoverAuthStorage() uses ~/.omp/agent/auth.json
|
||||
// Default: discoverAuthStorage() uses ~/.omp/agent/agent.db
|
||||
// discoverModels() loads built-in + custom models from ~/.omp/agent/models.json
|
||||
const authStorage = await discoverAuthStorage();
|
||||
const modelRegistry = await discoverModels(authStorage);
|
||||
@@ -25,7 +25,7 @@ await createAgentSession({
|
||||
console.log("Session with default auth storage and model registry");
|
||||
|
||||
// Custom auth storage location
|
||||
const customAuthStorage = new AuthStorage("/tmp/my-app/auth.json");
|
||||
const customAuthStorage = await AuthStorage.create("/tmp/my-app/agent.db");
|
||||
const customModelRegistry = new ModelRegistry(customAuthStorage, "/tmp/my-app/models.json");
|
||||
|
||||
await createAgentSession({
|
||||
|
||||
@@ -77,7 +77,7 @@ const { session } = await createAgentSession({
|
||||
});
|
||||
|
||||
// Full control
|
||||
const customAuth = new AuthStorage("/my/app/auth.json");
|
||||
const customAuth = await AuthStorage.create("/my/app/agent.db");
|
||||
customAuth.setRuntimeApiKey("anthropic", Bun.env.MY_KEY!);
|
||||
const customRegistry = new ModelRegistry(customAuth);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user