Download packages/agent-core-v2/src/app/mcpConfig/oauthService.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/app/mcpConfig/oauthService.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/agent-core-v2/src/app/mcpConfig/oauthService.ts
-
curl -L -o oauthService.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/agent-core-v2/src/app/mcpConfig/oauthService.ts
1.3 kB
| import { createDecorator, type ServiceIdentifier } from '#/_base/di/instantiation'; | |
| import { ScopeActivation, registerScopedService } from '#/_base/di/scope'; | |
| import { ILogService } from '#/_base/log/log'; | |
| import { IAgentIdentity } from '#/app/agentIdentity/agentIdentity'; | |
| import { LifecycleScope } from '#/app/scopes'; | |
| import { McpOAuthService } from '#/mcpCore/oauth/service'; | |
| import { IMcpOAuthStore } from './oauthStore'; | |
| export const IMcpOAuthService: ServiceIdentifier<McpOAuthService> = | |
| createDecorator<McpOAuthService>('mcpOAuthService'); | |
| export class AppMcpOAuthService extends McpOAuthService { | |
| constructor( | |
| store: IMcpOAuthStore, | |
| identity: IAgentIdentity, | |
| log: ILogService, | |
| ) { | |
| super({ | |
| store, | |
| resolveClientName: () => identity.current().slug, | |
| log, | |
| }); | |
| void identity | |
| .resolved() | |
| .then(() => { | |
| const sweep = this.sweepProactiveRefresh(); | |
| this.trackBackgroundTask(sweep); | |
| return sweep; | |
| }) | |
| .catch((error: unknown) => { | |
| log.warn(`mcp oauth proactive-refresh sweep failed: ${String(error)}`); | |
| }); | |
| } | |
| } | |
| registerScopedService( | |
| LifecycleScope.App, | |
| IMcpOAuthService, | |
| AppMcpOAuthService, | |
| ScopeActivation.OnDemand, | |
| 'mcpConfig', | |
| ); | |