(options: SDKRpcClientOptions = {})
| 50 | private readonly ready: Promise<RPCMethods<CoreAPI>>; |
| 51 | |
| 52 | constructor(options: SDKRpcClientOptions = {}) { |
| 53 | super(); |
| 54 | this.identity = |
| 55 | options.identity === undefined ? undefined : assertKimiHostIdentity(options.identity); |
| 56 | this.homeDir = resolveKimiHome(options.homeDir); |
| 57 | this.configPath = resolveConfigPath({ |
| 58 | homeDir: this.homeDir, |
| 59 | configPath: options.configPath, |
| 60 | }); |
| 61 | this.telemetry = options.telemetry ?? noopTelemetryClient; |
| 62 | this.auth = new KimiAuthFacade({ |
| 63 | homeDir: this.homeDir, |
| 64 | configPath: this.configPath, |
| 65 | identity: this.identity, |
| 66 | onRefresh: options.onOAuthRefresh, |
| 67 | }); |
| 68 | |
| 69 | void getRootLogger().configure(resolveLoggingConfig({ homeDir: this.homeDir })); |
| 70 | |
| 71 | const [coreRpc, sdkRpc] = createRPC<CoreAPI, SDKAPI>(); |
| 72 | this.core = new KimiCore(coreRpc, { |
| 73 | homeDir: options.homeDir, |
| 74 | configPath: this.configPath, |
| 75 | kimiRequestHeaders: this.createKimiRequestHeaders(), |
| 76 | resolveOAuthTokenProvider: |
| 77 | options.resolveOAuthTokenProvider ?? this.auth.resolveOAuthTokenProvider, |
| 78 | skillDirs: options.skillDirs, |
| 79 | telemetry: this.telemetry, |
| 80 | appVersion: this.identity?.version, |
| 81 | }); |
| 82 | this.ready = sdkRpc(new ClientAPI(this)); |
| 83 | } |
| 84 | |
| 85 | async ensureConfigFile(): Promise<void> { |
| 86 | await ensureConfigFile(this.configPath); |
nothing calls this directly
no test coverage detected