Archived
Migrate authService to async ModelRuntime API (slice 1)
Move AuthService off the removed AuthStorage / ModelRegistry.create surface
onto the async ModelRuntime API:
- AuthService.create({ agentDir | runtime }) async factory wrapping
ModelRuntime.create({ authPath, modelsPath }); createModelRuntimeForAgentDir
replaces createModelRegistryForAgentDir.
- saveApiKey -> runtime.login(providerId, "api_key", nonInteractive) so the
key is persisted through the runtime credential store.
- logoutProvider -> runtime.logout; refreshAuthState -> await runtime.refresh().
- startOAuthLogin now passes the runtime into OAuthLoginFlowService.start.
- authProviders/requireOAuthLoginProvider became async around getLogin/Logout
provider options.
- sessiond.ts: async createRuntime, AuthService.create, pass modelRuntime to
PiSessionService; sessionDaemonStartup awaits createRuntime.
Cross-slice: authProviderOptions (2), oauthLoginFlowService (3), and
piSessionService (4) still expose the old ModelRegistry shape, so the tree does
not fully typecheck yet. Session-daemon path changed -> manual sessiond restart
needed once the migration lands.
This commit is contained in:
@@ -12,7 +12,7 @@ export interface SessionDaemonStartupLogger {
|
||||
|
||||
export interface SessionDaemonStartupSteps<Runtime> {
|
||||
logger: SessionDaemonStartupLogger;
|
||||
createRuntime(): Runtime;
|
||||
createRuntime(): Runtime | Promise<Runtime>;
|
||||
registerRoutes(runtime: Runtime): void;
|
||||
listen(runtime: Runtime): Promise<void>;
|
||||
migrateArchive?: () => Promise<LegacySessionArchiveMigrationResult>;
|
||||
@@ -36,7 +36,7 @@ export async function runSessionDaemonStartup<Runtime>(
|
||||
);
|
||||
}
|
||||
|
||||
const runtime = steps.createRuntime();
|
||||
const runtime = await steps.createRuntime();
|
||||
steps.registerRoutes(runtime);
|
||||
await steps.listen(runtime);
|
||||
return runtime;
|
||||
|
||||
Reference in New Issue
Block a user