MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / constructor

Method constructor

packages/node-sdk/src/sdk-rpc-client.ts:52–83  ·  view source on GitHub ↗
(options: SDKRpcClientOptions = {})

Source from the content-addressed store, hash-verified

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);

Callers

nothing calls this directly

Calls 8

resolveKimiHomeFunction · 0.90
resolveConfigPathFunction · 0.90
getRootLoggerFunction · 0.90
resolveLoggingConfigFunction · 0.90
createRPCFunction · 0.90
assertKimiHostIdentityFunction · 0.85
configureMethod · 0.65

Tested by

no test coverage detected