Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
fix(kimi): install and sign in to Kimi from Settings, on a Cloud with no terminal (#4026)
Aditya Umalefc77d3b3db9f
diff --git a/apps/docs/content/docs/security/analytics.mdx b/apps/docs/content/docs/security/analytics.mdxindex e3cbcae746..ad6e1bc315 100644--- a/apps/docs/content/docs/security/analytics.mdx+++ b/apps/docs/content/docs/security/analytics.mdx@@ -144,7 +144,7 @@ use their own Boat key, and how many bots run on cloud computers, without sendin| `bot_created` | You create a bot with New bot, or from a ready-made bot in Templates | `source`: `blank` (New bot), `template` (a starting role), `preset`; `template`: starting role, only when `source` is `template` || `api_key_saved` | You save a key in Settings → API keys, in the Screen panel, in the model picker, on the X card in Apps, from a bot's request in a chat, or by adding an OpenAI-compatible server | `provider`: key provider; `via`: `settings`, `computer_panel`, `model_picker`, `apps`, `chat_request`; `result`: `ok` (the provider accepted it), `rejected` (the provider refused it), `unverified` (saved, not checked), `error` (not saved) || `api_key_removed` | You clear a key of your own in Settings → API keys, the Screen panel, the model picker or the X card in Apps | `provider`: key provider; `via`: `settings`, `computer_panel`, `model_picker`, `apps` |-| `engine_signed_in` | You finish signing in to an engine inside the app | `engine`: `claude`, `codex`, `grok`; `method`: `code`, `device_code`, `browser` |+| `engine_signed_in` | You finish signing in to an engine inside the app | `engine`: `claude`, `codex`, `grok`, `kimi`; `method`: `code`, `device_code`, `browser` || `connector_connect` | A Connect you started in Connected apps ends | `app`: app; `result`: `connected` (the account it added works), `failed` or `expired` (that account failed or expired), `timed_out` (neither within two minutes) || `app_snapshot` | Once a day, as described above | The properties in the snapshot table || `cloud_card_shown` | The MausBot Cloud card is shown | `variant`: `signed_out`, `free` |diff --git a/docs/analytics.md b/docs/analytics.mdindex 86cd1c71ab..867d1d848f 100644--- a/docs/analytics.md+++ b/docs/analytics.md@@ -140,7 +140,7 @@ use their own Boat key, and how many bots run on cloud computers, without sendin| `bot_created` | You create a bot with New bot, or from a ready-made bot in Templates | `source`: `blank` (New bot), `template` (a starting role), `preset`; `template`: starting role, only when `source` is `template` || `api_key_saved` | You save a key in Settings → API keys, in the Screen panel, in the model picker, on the X card in Apps, from a bot's request in a chat, or by adding an OpenAI-compatible server | `provider`: key provider; `via`: `settings`, `computer_panel`, `model_picker`, `apps`, `chat_request`; `result`: `ok` (the provider accepted it), `rejected` (the provider refused it), `unverified` (saved, not checked), `error` (not saved) || `api_key_removed` | You clear a key of your own in Settings → API keys, the Screen panel, the model picker or the X card in Apps | `provider`: key provider; `via`: `settings`, `computer_panel`, `model_picker`, `apps` |-| `engine_signed_in` | You finish signing in to an engine inside the app | `engine`: `claude`, `codex`, `grok`; `method`: `code`, `device_code`, `browser` |+| `engine_signed_in` | You finish signing in to an engine inside the app | `engine`: `claude`, `codex`, `grok`, `kimi`; `method`: `code`, `device_code`, `browser` || `connector_connect` | A Connect you started in Connected apps ends | `app`: app; `result`: `connected` (the account it added works), `failed` or `expired` (that account failed or expired), `timed_out` (neither within two minutes) || `app_snapshot` | Once a day, as described above | The properties in the snapshot table || `cloud_card_shown` | The MausBot Cloud card is shown | `variant`: `signed_out`, `free` |diff --git a/docs/pr-screenshots/cloud-kimi/1-before-not-installed.png b/docs/pr-screenshots/cloud-kimi/1-before-not-installed.pngnew file mode 100644index 0000000000..b0f4fe7daaBinary files /dev/null and b/docs/pr-screenshots/cloud-kimi/1-before-not-installed.png differdiff --git a/docs/pr-screenshots/cloud-kimi/2-before-sign-in.png b/docs/pr-screenshots/cloud-kimi/2-before-sign-in.pngnew file mode 100644index 0000000000..508176f5dcBinary files /dev/null and b/docs/pr-screenshots/cloud-kimi/2-before-sign-in.png differdiff --git a/docs/pr-screenshots/cloud-kimi/3-after-install-here.png b/docs/pr-screenshots/cloud-kimi/3-after-install-here.pngnew file mode 100644index 0000000000..15f6c59e43Binary files /dev/null and b/docs/pr-screenshots/cloud-kimi/3-after-install-here.png differdiff --git a/docs/pr-screenshots/cloud-kimi/4-after-real-sign-in-code.png b/docs/pr-screenshots/cloud-kimi/4-after-real-sign-in-code.pngnew file mode 100644index 0000000000..5a89554ff5Binary files /dev/null and b/docs/pr-screenshots/cloud-kimi/4-after-real-sign-in-code.png differdiff --git a/server/contracts.ts b/server/contracts.tsindex 57aba0fed8..36028ef04b 100644--- a/server/contracts.ts+++ b/server/contracts.ts@@ -367,6 +367,9 @@ export interface EngineInstall {signInCommand?: string;/** `command` needs npm on PATH, so the UI can say so when Node is absent. */needsNode?: boolean;+ /** The vendor's npm package, for an engine whose `command` is its own installer script: Settings installs it on the+ * server when npm is there, while a terminal keeps the vendor's command. */+ npmPackage?: string;/** The app downloads and verifies a pinned provider runtime itself. */managed?: {label: string;diff --git a/server/drivers/acp/kimi-device-auth.test.ts b/server/drivers/acp/kimi-device-auth.test.tsnew file mode 100644index 0000000000..fcd558adae--- /dev/null+++ b/server/drivers/acp/kimi-device-auth.test.ts@@ -0,0 +1,228 @@+// Every process here is the offline fake kimi in a disposable HOME: no real Kimi, no Moonshot call, no credentials.+import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";+import { tmpdir } from "node:os";+import { join } from "node:path";+import { fileURLToPath } from "node:url";+import { afterEach, beforeEach, describe, expect, it } from "vitest";+import { deviceSignInLink, deviceSignInPrompt, isDeviceSignInCode } from "../../../shared/device-sign-in.ts";+import type { ProviderInstance } from "../../contracts.ts";+import { serverInstallFor } from "../../engine-install.ts";+import { removeTempDir } from "../../testing/cleanup.ts";+import { DeviceAuthController } from "../device-auth.ts";+import { KIMI_DEVICE_SIGN_IN, KimiAgentDriver } from "./kimi.ts";++const FAKE_KIMI = fileURLToPath(new URL("../../testing/fake-kimi-login-cli.ts", import.meta.url));+const CODE = "QKXP-7M4D";+const PAGE = `https://www.kimi.com/code/authorize_device?user_code=${CODE}`;++describe("Kimi on a server without a terminal", () => {+ it("installs from Settings with Moonshot's npm package when the server has npm", () => {+ expect(serverInstallFor(KimiAgentDriver.install, true)).toEqual({ package: "@moonshot-ai/kimi-code" });+ expect(serverInstallFor(KimiAgentDriver.install, false)).toBeNull();+ });++ it("keeps Moonshot's own installer as the command for a terminal", () => {+ expect(KimiAgentDriver.install?.command?.linux).toBe("curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash");+ });+});++describe("Kimi device prompt", () => {+ // kimi-code 2.4.1's own stderr lines (src/cli/sub/login-flow.ts).+ const printed = (page: string, code = CODE) => [+ "",+ `Opening browser for Kimi device login: ${page}`,+ `If the browser did not open, paste the URL above and enter code: ${code}`,+ "Code expires in 600s.",+ "Waiting for authorization to complete…",+ "",+ ].join("\n");++ it("reads Moonshot's page and the code from Kimi's labelled lines", () => {+ expect(deviceSignInPrompt("kimi", printed(PAGE))).toEqual({ authorizationUrl: PAGE, userCode: CODE });+ const global = `https://www.kimi.ai/code/authorize_device?user_code=${CODE}`;+ expect(deviceSignInPrompt("kimi", printed(global))).toEqual({ authorizationUrl: global, userCode: CODE });+ expect(deviceSignInPrompt("kimi", printed("https://auth.kimi.com/device"))).toEqual({ authorizationUrl: "https://auth.kimi.com/device", userCode: CODE });+ });++ it("waits for the code line to arrive whole", () => {+ expect(deviceSignInPrompt("kimi", `\nOpening browser for Kimi device login: ${PAGE}\nIf the browser did not open, paste the URL above and enter code: QKXP-7`)).toBeNull();+ });++ it("follows the new code Kimi prints once the first expires", () => {+ const renewed = "https://www.kimi.com/code/authorize_device?user_code=RW7N-2KQ9";+ expect(deviceSignInPrompt("kimi", printed(PAGE) + printed(renewed, "RW7N-2KQ9"))).toEqual({ authorizationUrl: renewed, userCode: "RW7N-2KQ9" });+ expect(deviceSignInPrompt("kimi", `${printed(PAGE)}\nOpening browser for Kimi device login: ${renewed}\n`)).toEqual({ authorizationUrl: PAGE, userCode: CODE });+ });++ it("keeps only the code in the page's query, and only when it is that same code", () => {+ expect(deviceSignInPrompt("kimi", printed(`${PAGE}&state=secret-token`))).toEqual({ authorizationUrl: PAGE, userCode: CODE });+ expect(deviceSignInPrompt("kimi", printed("https://www.kimi.com/code/authorize_device?user_code=ZZZZ-ZZZZ"))).toBeNull();+ });++ it.each([+ "http://www.kimi.com/code/authorize_device",+ "https://kimi.com.evil.test/device",+ "https://evilkimi.com/device",+ "https://[email protected]/device",+ "https://www.kimi.com:8443/device",+ "https://www.kimi.com/device#token",+ "https://accounts.x.ai/device",+ ])("never turns another page into a sign-in link: %s", (page) => {+ expect(deviceSignInPrompt("kimi", printed(page))).toBeNull();+ expect(deviceSignInLink("kimi", page, CODE)).toBeNull();+ });++ it("knows a code from other output", () => {+ expect(isDeviceSignInCode("kimi", CODE)).toBe(true);+ expect(isDeviceSignInCode("kimi", "KLXE-NNPJ")).toBe(true);+ for (const line of ["Code expires in 600s.", "Waiting", "Opening", "klxe-nnpj", "AB", ""]) expect(isDeviceSignInCode("kimi", line)).toBe(false);+ });+});++describe.skipIf(process.platform === "win32")("Kimi Code sign-in with a device code", () => {+ let home: string;+ let instances: ProviderInstance[];+ const kimi = async (mode: string, environment: Record<string, string> = {}) => {+ const instance = await KimiAgentDriver.create({+ instanceId: "kimi", displayName: "Kimi", enabled: true,+ config: KimiAgentDriver.decodeConfig({ cli: FAKE_KIMI }),+ // A stray Moonshot key must not reach the subscription login.+ environment: { HOME: home, USERPROFILE: home, OMB_DEVICE_AUTH_FIXTURE: "1", FAKE_KIMI_MODE: mode, MOONSHOT_API_KEY: "sk-fixture-must-not-leak", ...environment },+ });+ instances.push(instance);+ return instance;+ };+ const calls = () => readFileSync(join(home, "fake-kimi-calls.jsonl"), "utf8").trim().split("\n").map((line) => JSON.parse(line));+ const pid = () => Number(readFileSync(join(home, "fake-kimi-login.pid"), "utf8"));+ const alive = (target: number) => { try { process.kill(target, 0); return true; } catch { return false; } };+ const credential = (root = join(home, ".kimi-code")) => join(root, "credentials", "kimi-code.json");++ beforeEach(() => {+ chmodSync(FAKE_KIMI, 0o755);+ home = mkdtempSync(join(tmpdir(), "omb-kimi-device-"));+ instances = [];+ });+ afterEach(async () => {+ await Promise.all(instances.map((instance) => instance.dispose()));+ await removeTempDir(home);+ });++ it("shows Moonshot's page and code, then confirms the sign-in the driver's own check reads", async () => {+ const instance = await kimi("success");+ expect((await instance.snapshot()).authenticated).toBe(false);+ const start = await instance.startAuthentication!();+ expect(start).toMatchObject({ phase: "waiting", authorizationUrl: PAGE, userCode: CODE, flowId: expect.stringMatching(/^[0-9a-f-]{36}$/) });+ await expect.poll(() => instance.getAuthentication!(start.flowId!), { timeout: 5_000 })+ .toEqual({ phase: "succeeded", flowId: start.flowId, authorizationUrl: null, expiresAt: null });+ expect(existsSync(credential())).toBe(true);+ expect((await instance.snapshot()).authenticated).toBe(true);+ const logins = calls().filter((call) => call.args[0] === "login");+ expect(logins).toEqual([{ args: ["login"], home, kimiHome: join(home, ".kimi-code"), moonshotKey: null }]);+ });++ it("signs in to the instance's own KIMI_CODE_HOME, and reads it there", async () => {+ const kimiHome = join(home, "work-kimi");+ const instance = await kimi("success", { KIMI_CODE_HOME: kimiHome });+ const start = await instance.startAuthentication!();+ await expect.poll(async () => (await instance.getAuthentication!(start.flowId!)).phase, { timeout: 5_000 }).toBe("succeeded");+ expect(existsSync(credential(kimiHome))).toBe(true);+ expect(existsSync(credential())).toBe(false);+ expect((await instance.snapshot()).authenticated).toBe(true);+ });++ it("confirms a kimi.ai sign-in, which Kimi saves under its own token name", async () => {+ const instance = await kimi("global");+ const start = await instance.startAuthentication!();+ expect(start).toMatchObject({ authorizationUrl: `https://www.kimi.ai/code/authorize_device?user_code=${CODE}`, userCode: CODE });+ await expect.poll(async () => (await instance.getAuthentication!(start.flowId!)).phase, { timeout: 5_000 }).toBe("succeeded");+ expect(existsSync(credential())).toBe(false);+ expect((await instance.snapshot()).authenticated).toBe(true);+ });++ it("does not count another file in Kimi's credentials folder as a sign-in", async () => {+ mkdirSync(join(home, ".kimi-code", "credentials"), { recursive: true });+ writeFileSync(join(home, ".kimi-code", "credentials", "kimi-code-env-0123456789abcdef.json.tmp.1.x"), "{}");+ writeFileSync(join(home, ".kimi-code", "credentials", "other-provider.json"), "{}");+ expect((await (await kimi("waiting")).snapshot()).authenticated).toBe(false);+ });++ it("does not count a sign-in Kimi revoked, which it keeps with empty tokens", async () => {+ mkdirSync(join(home, ".kimi-code", "credentials"), { recursive: true });+ writeFileSync(credential(), JSON.stringify({ access_token: "", refresh_token: "", expires_at: 0, scope: "", token_type: "", expires_in: 0 }));+ expect((await (await kimi("waiting")).snapshot()).authenticated).toBe(false);+ });++ it("shows the new code Kimi prints once the first expires", async () => {+ const instance = await kimi("renew");+ const start = await instance.startAuthentication!();+ expect(start).toMatchObject({ authorizationUrl: PAGE, userCode: CODE });+ await expect.poll(async () => (await instance.getAuthentication!(start.flowId!)).userCode, { timeout: 5_000 }).toBe("RW7N-2KQ9");+ expect(await instance.getAuthentication!(start.flowId!)).toMatchObject({+ phase: "waiting", authorizationUrl: "https://www.kimi.com/code/authorize_device?user_code=RW7N-2KQ9",+ });+ });++ it("shows a page without the CLI's other query values", async () => {+ const instance = await kimi("extra");+ const start = await instance.startAuthentication!();+ expect(start).toMatchObject({ authorizationUrl: PAGE, userCode: CODE });+ expect(JSON.stringify(start)).not.toContain("secret-token");+ });++ it("cancels: the login process stops and the code is gone", async () => {+ const instance = await kimi("ignore-term");+ const start = await instance.startAuthentication!();+ expect(alive(pid())).toBe(true);+ await instance.cancelAuthentication!();+ expect(alive(pid())).toBe(false);+ const status = await instance.getAuthentication!(start.flowId!);+ expect(status).toMatchObject({ phase: "cancelled", message: "Kimi Code sign-in cancelled.", authorizationUrl: null });+ expect(status.userCode).toBeUndefined();+ expect(existsSync(credential())).toBe(false);+ });++ it("does not show a page on another host, and gives up waiting for one", async () => {+ const controller = new DeviceAuthController(KIMI_DEVICE_SIGN_IN, {+ cli: FAKE_KIMI, startupTimeoutMs: 1_000, terminateTimeoutMs: 50,+ environment: () => ({ ...process.env, HOME: home, OMB_DEVICE_AUTH_FIXTURE: "1", FAKE_KIMI_MODE: "evil" }),+ });+ try {+ await expect(controller.start()).rejects.toThrow("Kimi did not provide a sign-in code in time");+ await controller.cancel();+ expect(alive(pid())).toBe(false);+ } finally { await controller.dispose(); }+ });++ it.each([+ ["expired", "The Kimi sign-in code expired. Start sign-in again for a new code."],+ ["denied", "Kimi sign-in was declined in the browser. Start sign-in again to try once more."],+ ["crash", "Kimi sign-in did not finish. Check the server's connection, then try again."],+ ["no-credential", "Kimi finished sign-in but did not confirm a Kimi Code account. Refresh Settings and try again."],+ ])("ends a %s sign-in with one plain message and none of the CLI's words", async (mode, message) => {+ const instance = await kimi(mode);+ const start = await instance.startAuthentication!();+ await expect.poll(async () => (await instance.getAuthentication!(start.flowId!)).phase, { timeout: 5_000 }).toBe("failed");+ const status = await instance.getAuthentication!(start.flowId!);+ expect(status.message).toBe(message);+ expect(JSON.stringify(status)).not.toContain("secret-token");+ expect((await instance.snapshot()).authenticated).toBe(false);+ });++ it("says plainly when Kimi is missing on the server", async () => {+ const missing = await KimiAgentDriver.create({+ instanceId: "kimi-missing", displayName: "Kimi", enabled: true,+ config: KimiAgentDriver.decodeConfig({ cli: join(home, "no-such-kimi") }),+ environment: { HOME: home, OMB_DEVICE_AUTH_FIXTURE: "1" },+ });+ instances.push(missing);+ await expect(missing.startAuthentication!()).rejects.toThrow("Kimi is not installed on this server.");+ });++ it("approves through the reusable fixture only once its local marker exists", async () => {+ const instance = await kimi("approve");+ const start = await instance.startAuthentication!();+ expect((await instance.getAuthentication!(start.flowId!)).phase).toBe("waiting");+ writeFileSync(join(home, ".omb-fake-kimi-approved"), "approve fixture only\n");+ await expect.poll(async () => (await instance.getAuthentication!(start.flowId!)).phase, { timeout: 5_000 }).toBe("succeeded");+ });+});diff --git a/server/drivers/acp/kimi.ts b/server/drivers/acp/kimi.tsindex 65d0589566..623fa5f024 100644--- a/server/drivers/acp/kimi.ts+++ b/server/drivers/acp/kimi.ts@@ -1,10 +1,11 @@// Kimi Code: Moonshot's `kimi acp` on the Kimi Code subscription login-// (~/.kimi-code/credentials/kimi-code.json), not a Moonshot API key. Verified on kimi-code 0.29.1.-import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";+// (~/.kimi-code/credentials), not a Moonshot API key. Verified on kimi-code 0.29.1.+import { mkdirSync, readdirSync, readFileSync, writeFileSync } from "node:fs";import { homedir } from "node:os";import { join } from "node:path";import type { ModelCatalog } from "../../contracts.ts";+import type { DeviceSignIn } from "../device-auth.ts";import { decodeInjectId, hostApiKey, LOCAL_HOSTS, localHost, mergeLocalInject } from "../local-inject.ts";import { createAcpDriver, type AcpSupport } from "./core.ts";@@ -29,10 +30,54 @@ function kimiDataRoot(env: Record<string, string | undefined>): string {return env.KIMI_CODE_HOME || join(env.HOME || env.USERPROFILE || homedir(), ".kimi-code");}-function credentialsPath(env: Record<string, string | undefined>) {- return join(kimiDataRoot(env), "credentials", "kimi-code.json");+/** kimi-code 2.4.1 (resolveKimiTokenStorageName) keeps a kimi.com login in credentials/kimi-code.json and a kimi.ai+ * one, the region it picks outside China, in credentials/kimi-code-env-<hash>.json. */+const KIMI_TOKEN_FILE = /^kimi-code(?:-env-[0-9a-f]+)?\.json$/;++/** kimi-code 2.4.1 (revokedTombstone) keeps a sign-in the provider refused as a file with both tokens empty, and reads an+ * unparseable file as no sign-in. */+function kimiTokenHeld(path: string): boolean {+ try {+ const token: unknown = JSON.parse(readFileSync(path, "utf8"));+ if (!token || typeof token !== "object") return false;+ const { access_token: access, refresh_token: refresh } = token as Record<string, unknown>;+ return !(access === "" && refresh === "");+ } catch {+ return false;+ }}+/** Reads the child's own data root (a custom HOME or KIMI_CODE_HOME), never the server user's. */+function kimiSignedIn(env: Record<string, string | undefined>): boolean {+ const credentials = join(kimiDataRoot(env), "credentials");+ try {+ return readdirSync(credentials).some((name) => KIMI_TOKEN_FILE.test(name) && kimiTokenHeld(join(credentials, name)));+ } catch {+ return false;+ }+}++/** Never the CLI's own words, which may carry tokens (kimi-code 2.4.1 ends with "Login failed: …" or "Login cancelled: …",+ * and after 900s with "Login failed: Device authorization timed out"). */+function kimiLoginFailure(output: string): string {+ if (/expired|timed out/i.test(output)) return "The Kimi sign-in code expired. Start sign-in again for a new code.";+ if (/denied|login cancelled/i.test(output)) return "Kimi sign-in was declined in the browser. Start sign-in again to try once more.";+ return "Kimi sign-in did not finish. Check the server's connection, then try again.";+}++/** `kimi login`, Kimi Code's device-code login (kimi-code 2.4.1). Kimi has no status command, so nothing is checked first. */+export const KIMI_DEVICE_SIGN_IN: DeviceSignIn = {+ provider: "kimi",+ product: "Kimi",+ account: "Kimi Code",+ homeEnv: "KIMI_CODE_HOME",+ homeDir: ".kimi-code",+ loginArgs: ["login"],+ install: "Install it with Moonshot's installer (https://code.kimi.com), or from Settings when this server has npm, then try again.",+ failure: kimiLoginFailure,+ signedIn: kimiSignedIn,+};+function quoteToml(value: string): string {return `"${value.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;}@@ -481,7 +526,7 @@ const support: AcpSupport = {resolveModels: (env) => mergeLocalInject(readKimiModelCatalog(env), env),defaultCli: "kimi",nativeSource: "kimi.acp",- loginNote: "Kimi Code CLI is not signed in — run `kimi login` in a terminal",+ loginNote: "Kimi is not signed in to your Kimi Code account — choose Sign in to Kimi in engine setup",install: {command: {@@ -489,9 +534,11 @@ const support: AcpSupport = {linux: "curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash",win32: "irm https://code.kimi.com/kimi-code/install.ps1 | iex",},+ npmPackage: "@moonshot-ai/kimi-code",docsUrl: "https://moonshotai.github.io/kimi-code/en/guides/getting-started.html",signInCommand: "kimi login",},+ deviceSignIn: KIMI_DEVICE_SIGN_IN,// -m is a global commander option and must precede `acp` (0.29.1).resolveTurnModel: (model, env) => (model ? ensureKimiInjectAlias(model, env) : model),@@ -513,8 +560,7 @@ const support: AcpSupport = {// The only authMethod is {id:"login", type:"terminal"}, a device-code flow ACP cannot drive.pickAuthMethod: () => null,authFailure: "continue",- // The child's own data root: a custom HOME or KIMI_CODE_HOME, never the server user's.- isAuthenticated: (env) => existsSync(credentialsPath(env)),+ isAuthenticated: kimiSignedIn,buildPromptText: (turn) => (turn.system ? `${turn.system}\n\n${turn.text}` : turn.text),};diff --git a/server/drivers/device-auth.ts b/server/drivers/device-auth.tsindex a961377b41..7d6c0228b9 100644--- a/server/drivers/device-auth.ts+++ b/server/drivers/device-auth.ts@@ -292,9 +292,10 @@ export class DeviceAuthController {return;}output += chunk.toString("utf8");- const prompt = parsePrompt && !flow.ready ? deviceSignInPrompt(provider, stripVTControlCharacters(output)) : null;- if (prompt) {- flow.status = { ...flow.status, ...prompt };+ const prompt = parsePrompt ? deviceSignInPrompt(provider, stripVTControlCharacters(output)) : null;+ if (!prompt || (prompt.userCode === flow.status.userCode && prompt.authorizationUrl === flow.status.authorizationUrl)) return;+ flow.status = { ...flow.status, ...prompt };+ if (!flow.ready) {flow.ready = true;clearTimeout(flow.startupTimer);flow.resolve({ ...flow.status, phase: "waiting" });diff --git a/server/engine-homes/layout.test.ts b/server/engine-homes/layout.test.tsindex 079abfa49d..f96647f7b8 100644--- a/server/engine-homes/layout.test.ts+++ b/server/engine-homes/layout.test.ts@@ -29,6 +29,9 @@ linux("an audience's engine home", () => {expect(homed.shared).toContainEqual({ source: "/data/.codex/auth.json", target: `${bob}/.codex/auth.json` });expect(homed.shared).toContainEqual({ source: "/data/.grok/auth.json", target: `${bob}/.grok/auth.json` });expect(homed.shared).toContainEqual({ source: "/data/.local/share/opencode/auth.json", target: `${bob}/.local/share/opencode/auth.json` });+ for (const file of ["kimi-code.json", "kimi-code-env-0e4f99c69cc27850.json"]) {+ expect(homed.shared).toContainEqual({ source: `/data/.kimi-code/credentials/${file}`, target: `${bob}/.kimi-code/credentials/${file}` });+ }// Transcripts and session state are never shared: only sign-in files are named.for (const file of homed.shared) expect(file.target).not.toMatch(/projects|sessions|history/);expect(homed.shared.every((file) => file.target.startsWith(`${bob}/`))).toBe(true);diff --git a/server/engine-homes/layout.ts b/server/engine-homes/layout.tsindex 1c7ebee630..e49133bd0b 100644--- a/server/engine-homes/layout.ts+++ b/server/engine-homes/layout.ts@@ -47,12 +47,16 @@ export interface EngineFolder {shared: readonly string[];}+/** kimi-code 2.4.1 (resolveKimiCodeOAuthKey) names a kimi.ai sign-in after its region's OAuth host and API address. */+const KIMI_AI_SIGN_IN = `credentials/kimi-code-env-${createHash("sha256")+ .update(JSON.stringify({ oauthHost: "https://auth.kimi.ai", baseUrl: "https://api.kimi.ai/coding/v1" })).digest("hex").slice(0, 16)}.json`;+/** File names as each engine's sign-in keeps them (the drivers' own sign-in checks read the same ones). */export const ENGINE_FOLDERS: readonly EngineFolder[] = [{ env: "CLAUDE_CONFIG_DIR", home: ".claude", shared: [".credentials.json"] },{ env: "CODEX_HOME", home: ".codex", shared: ["auth.json", "config.toml"] },{ env: "GROK_HOME", home: ".grok", shared: ["auth.json", "config.toml"] },- { env: "KIMI_CODE_HOME", home: ".kimi-code", shared: ["credentials/kimi-code.json", "config.toml"] },+ { env: "KIMI_CODE_HOME", home: ".kimi-code", shared: ["credentials/kimi-code.json", KIMI_AI_SIGN_IN, "config.toml"] },{ env: "DSH_HOME", home: ".dsh", shared: [".credentials.yaml", ".env"] },{ env: "FACTORY_HOME_OVERRIDE", home: "", shared: [".factory/auth.v2.file", ".factory/auth.v2.keyring", ".factory/settings.json"] },{ env: "XDG_CONFIG_HOME", home: ".config", shared: ["muse/auth.json"] },diff --git a/server/engine-install.ts b/server/engine-install.tsindex 3c4d1a2ce6..89aa947dd7 100644--- a/server/engine-install.ts+++ b/server/engine-install.ts@@ -54,6 +54,7 @@ export function applyStandaloneSpawnEnv(release: StandaloneRelease, env: Record<}export function npmPackageOf(install: EngineInstall | undefined): string | null {+ if (install?.npmPackage) return install.npmPackage;const line = install?.command?.linux ?? install?.command?.darwin ?? install?.command?.win32;const match = line ? /^npm install -g ((?:@[\w.-]+\/)?[\w.-]+)$/.exec(line.trim()) : null;return match ? match[1]! : null;diff --git a/server/testing/fake-kimi-login-cli.ts b/server/testing/fake-kimi-login-cli.tsnew file mode 100755index 0000000000..d6511bcfbd--- /dev/null+++ b/server/testing/fake-kimi-login-cli.ts@@ -0,0 +1,62 @@+#!/usr/bin/env node+// Offline stand-in for Moonshot's `kimi` CLI sign-in (`--version`, `login` printing kimi-code 2.4.1's device+// instructions to stderr): no network, no real credential; needs explicit opt-in and a disposable HOME.+// FAKE_KIMI_MODE success | global (kimi.ai, saved under its own token name) | approve (once+// HOME/.omb-fake-kimi-approved exists) | waiting | renew (a new code, as once the first expires) | extra (a page with+// another query value) | evil (a page on another host) | expired | denied | crash | no-credential | ignore-term+import { appendFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";+import { isAbsolute, join } from "node:path";++const home = process.env.HOME;+if (process.env.OMB_DEVICE_AUTH_FIXTURE !== "1" || !home || !isAbsolute(home)) {+ process.stderr.write("This fake CLI requires OMB_DEVICE_AUTH_FIXTURE=1 and an isolated HOME.\n");+ process.exit(2);+}+const kimiHome = process.env.KIMI_CODE_HOME || join(home, ".kimi-code");+const mode = process.env.FAKE_KIMI_MODE || "success";+const args = process.argv.slice(2);+appendFileSync(join(home, "fake-kimi-calls.jsonl"), `${JSON.stringify({ args, home, kimiHome, moonshotKey: process.env.MOONSHOT_API_KEY ?? null })}\n`);++const signIn = () => {+ mkdirSync(join(kimiHome, "credentials"), { recursive: true });+ const token = mode === "global" ? "kimi-code-env-0e4f99c69cc27850.json" : "kimi-code.json";+ writeFileSync(join(kimiHome, "credentials", token), "{\"fixture\":\"offline, not a credential\"}\n", { mode: 0o600 });+ process.stderr.write("Logged in to Kimi Code.\n");+ process.exit(0);+};++if (args.join(" ") === "--version") {+ process.stdout.write("2.4.1\n");+} else if (args.join(" ") === "login") {+ writeFileSync(join(home, "fake-kimi-login.pid"), String(process.pid));+ const prompt = (code: string) => {+ const page = mode === "evil" ? `https://kimi.com.evil.test/device?user_code=${code}`+ : mode === "extra" ? `https://www.kimi.com/code/authorize_device?user_code=${code}&state=secret-token`+ : mode === "global" ? `https://www.kimi.ai/code/authorize_device?user_code=${code}`+ : `https://www.kimi.com/code/authorize_device?user_code=${code}`;+ process.stderr.write([+ "",+ `Opening browser for Kimi device login: ${page}`,+ `If the browser did not open, paste the URL above and enter code: ${code}`,+ "Code expires in 600s.",+ "Waiting for authorization to complete…",+ "",+ ].join("\n"));+ };+ prompt("QKXP-7M4D");+ const later = (then: () => void) => setTimeout(then, 80);+ if (mode === "success" || mode === "extra" || mode === "global") later(signIn);+ else if (mode === "approve") setInterval(() => { if (existsSync(join(home, ".omb-fake-kimi-approved"))) signIn(); }, 100);+ else if (mode === "no-credential") later(() => process.exit(0));+ else if (mode === "renew") { later(() => prompt("RW7N-2KQ9")); setInterval(() => {}, 1000); }+ else if (mode === "expired") later(() => { process.stderr.write("Login failed: Device authorization timed out after 900s secret-token\n"); process.exit(1); });+ else if (mode === "denied") later(() => { process.stderr.write("Login cancelled: access_denied secret-token\n"); process.exit(1); });+ else if (mode === "crash") later(() => { process.stderr.write("access_token=secret-token\n"); process.exit(1); });+ else {+ if (mode === "ignore-term") process.on("SIGTERM", () => {});+ setInterval(() => {}, 1000);+ }+} else {+ process.stderr.write("Unsupported offline fixture command.\n");+ process.exitCode = 2;+}diff --git a/shared/device-sign-in.ts b/shared/device-sign-in.tsindex 5ae0147ec2..9d3c3fc7d2 100644--- a/shared/device-sign-in.ts+++ b/shared/device-sign-in.ts@@ -1,15 +1,28 @@// Where a person enters the one-time code that signs an engine's CLI in on// the machine running OpenMausBot (`codex login --device-auth`, `grok login-// --device-auth`). The server reads the page and the code from the CLI's-// output with these rules, and the app checks them again before it shows a-// link. Neither ever turns arbitrary output into a link, or lets a token ride-// along in one.+// --device-auth`, `kimi login`). The server reads the page and the code from+// the CLI's output with these rules, and the app checks them again before it+// shows a link. Neither ever turns arbitrary output into a link, or lets a+// token ride along in one.-export type DeviceSignInProvider = "codex" | "grok";+export type DeviceSignInProvider = "codex" | "grok" | "kimi";const CODEX_PAGE = "https://auth.openai.com/codex/device";-const RULES: Record<DeviceSignInProvider, { page(value: string): string | null; code: RegExp }> = {+/** An https page on one of the provider's hosts, with no login, port or fragment. */+function providerPage(value: string, hosts: RegExp): URL | null {+ if (!/^https:\/\/[^\s#]+$/.test(value)) return null;+ let url: URL;+ try { url = new URL(value); } catch { return null; }+ return url.username || url.password || url.port || !hosts.test(url.hostname) ? null : url;+}++const RULES: Record<DeviceSignInProvider, {+ page(value: string): string | null;+ code: RegExp;+ /** The words a CLI prints before the page or the code on the same line. */+ label?: RegExp;+}> = {codex: {page: (value) => (/^https:\/\/auth\.openai\.com\/codex\/device\/?$/.test(value) ? CODEX_PAGE : null),code: /^[A-Z0-9]{4,8}-[A-Z0-9]{4,8}$/,@@ -18,13 +31,26 @@ const RULES: Record<DeviceSignInProvider, { page(value: string): string | null;// xAI's own sign-in hosts. The page may carry the code itself (the// provider's "complete" link); nothing else may ride in its query.page: (value) => {- if (!/^https:\/\/[^\s#]+$/.test(value)) return null;- let url: URL;- try { url = new URL(value); } catch { return null; }- if (url.username || url.password || url.port || !/(^|\.)(x\.ai|grok\.com)$/.test(url.hostname)) return null;- return [...url.searchParams.keys()].every((key) => key === "user_code") ? url.href : null;+ const url = providerPage(value, /(^|\.)(x\.ai|grok\.com)$/);+ return url && [...url.searchParams.keys()].every((key) => key === "user_code") ? url.href : null;+ },+ code: /^[A-Z0-9]{4,12}(?:-[A-Z0-9]{2,12}){0,3}$/,+ },+ kimi: {+ // Moonshot's hosts for both Kimi Code regions (kimi.com, kimi.ai). Its+ // OAuth server writes the "complete" link, so only the code is kept of+ // its query. kimi-code 2.4.1 prints "…device login: <page>" and "…enter+ // code: <code>".+ page: (value) => {+ const url = providerPage(value, /(^|\.)kimi\.(com|ai)$/);+ if (!url) return null;+ const code = url.searchParams.get("user_code");+ url.search = "";+ if (code !== null) url.searchParams.set("user_code", code);+ return url.href;},code: /^[A-Z0-9]{4,12}(?:-[A-Z0-9]{2,12}){0,3}$/,+ label: /^[^:]*\b(?:login|code):\s+/i,},};@@ -41,15 +67,20 @@ export function isDeviceSignInCode(provider: DeviceSignInProvider, value: stringreturn typeof value === "string" && RULES[provider].code.test(value);}-/** The page and the code from a CLI's output, once both lines have arrived- * whole: output arrives in chunks that may stop halfway through a code, so- * the last, unfinished line is never read. `text` is already free of- * terminal styling. */+/** The newest page and code from a CLI's output, once both lines have+ * arrived whole: output arrives in chunks that may stop halfway through a+ * code, so the last, unfinished line is never read. A CLI can print a new+ * pair when its code expires (kimi-code 2.4.1 does). `text` is already free+ * of terminal styling. */export function deviceSignInPrompt(provider: DeviceSignInProvider, text: string): { authorizationUrl: string; userCode: string } | null {- const lines = text.split(/\r?\n/).slice(0, -1).map((line) => line.trim());- const at = lines.findIndex((line) => RULES[provider].page(line) !== null);- if (at < 0) return null;- const userCode = lines.slice(at + 1).map((line) => line.replace(/^code:\s*/i, "")).find((line) => isDeviceSignInCode(provider, line));- const authorizationUrl = userCode ? deviceSignInLink(provider, lines[at], userCode) : null;- return authorizationUrl && userCode ? { authorizationUrl, userCode } : null;+ const { page, label } = RULES[provider];+ const lines = text.split(/\r?\n/).slice(0, -1).map((line) => (label ? line.trim().replace(label, "") : line.trim()));+ let prompt: { authorizationUrl: string; userCode: string } | null = null;+ for (const [at, line] of lines.entries()) {+ if (page(line) === null) continue;+ const userCode = lines.slice(at + 1).map((next) => next.replace(/^code:\s*/i, "")).find((next) => isDeviceSignInCode(provider, next));+ const authorizationUrl = userCode ? deviceSignInLink(provider, line, userCode) : null;+ if (authorizationUrl && userCode) prompt = { authorizationUrl, userCode };+ }+ return prompt;}diff --git a/src/components/DeviceSignIn.tsx b/src/components/DeviceSignIn.tsxindex d3387a2df4..e383119baf 100644--- a/src/components/DeviceSignIn.tsx+++ b/src/components/DeviceSignIn.tsx@@ -19,7 +19,11 @@ export interface DeviceSignInStatus {}export function deviceSignInProvider(driverKind: string): DeviceSignInProvider {- return driverKind === "grokAgent" ? "grok" : "codex";+ switch (driverKind) {+ case "grokAgent": return "grok";+ case "kimiAgent": return "kimi";+ default: return "codex";+ }}export const DEVICE_SIGN_IN_COPY: Record<DeviceSignInProvider, Record<"description" | "start" | "enterCode" | "open" | "security" | "connected" | "connectedAccount" | "failed" | "invalidChallenge", LocaleKey>> = {@@ -45,6 +49,17 @@ export const DEVICE_SIGN_IN_COPY: Record<DeviceSignInProvider, Record<"descriptifailed: "engineSetup.grok.failed",invalidChallenge: "engineSetup.grok.invalidChallenge",},+ kimi: {+ description: "engineSetup.kimi.description",+ start: "engineSetup.kimi.start",+ enterCode: "engineSetup.kimi.enterCode",+ open: "engineSetup.kimi.open",+ security: "engineSetup.kimi.security",+ connected: "engineSetup.kimi.connected",+ connectedAccount: "engineSetup.kimi.connectedAccount",+ failed: "engineSetup.kimi.failed",+ invalidChallenge: "engineSetup.kimi.invalidChallenge",+ },};export function deviceFlowUnavailable(cause: unknown): boolean {diff --git a/src/components/EngineSetup.kimi.test.ts b/src/components/EngineSetup.kimi.test.tsnew file mode 100644index 0000000000..d45c9bc566--- /dev/null+++ b/src/components/EngineSetup.kimi.test.ts@@ -0,0 +1,66 @@+// @vitest-environment happy-dom+import { createElement } from "react";+import { flushSync } from "react-dom";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";++import { setLocale } from "@/lib/i18n";+import { BotEditorStore, type InstanceInfo, type useStore } from "@/state/store";+import { EngineSetup } from "./EngineSetup";++const CURL = "curl -fsSL https://code.kimi.com/kimi-code/install.sh | bash";+const kimi = (snapshot: InstanceInfo["snapshot"]): InstanceInfo => ({+ instanceId: "kimi", driverKind: "kimiAgent", displayName: "Kimi",+ models: { default: "kimi-code/k3", options: [] }, snapshot,+ authentication: { method: "device-code", signOut: false },+ install: { command: { darwin: CURL, linux: CURL }, signInCommand: "kimi login", platform: "linux", server: { package: "@moonshot-ai/kimi-code" } },+});+const missing = kimi({ state: "unavailable", reason: "`kimi` isn't installed, or isn't on this app's PATH." });+const signedOut = kimi({ state: "available", authenticated: false, version: "2.4.1" });+const desktop = { platform: "darwin", openInstallTerminal: vi.fn(async () => true), remoteClient: { active: false } };++let host: HTMLDivElement;+let root: Root;+function render(engine: InstanceInfo, ogb: object | undefined, cloudHome = false): string {+ vi.stubGlobal("ogb", ogb);+ const store = { state: { config: cloudHome ? { cloudHome: true } : {} }, dispatch: vi.fn(), refreshInstances: vi.fn(), refreshModels: vi.fn() } as unknown as ReturnType<typeof useStore>;+ flushSync(() => root.render(createElement(BotEditorStore, { value: store, children: createElement(EngineSetup, { instance: engine }) })));+ return host.innerHTML;+}++beforeEach(() => {+ setLocale("en");+ host = document.createElement("div");+ document.body.append(host);+ root = createRoot(host);+});+afterEach(() => {+ flushSync(() => root.unmount());+ host.remove();+ vi.unstubAllGlobals();+});++describe("Kimi on My Cloud, which has no terminal", () => {+ it("installs from Settings, with Moonshot's command only to copy", () => {+ const html = render(missing, desktop, true);+ expect(html).toContain("Install Kimi here");+ expect(html).toContain("Prefer a terminal?");+ expect(html).toContain(CURL);+ expect(html).not.toContain("Open install in Terminal");+ });++ it("signs in with Kimi's code on the server's page, with no terminal command", () => {+ const html = render(signedOut, desktop, true);+ expect(html).toContain('data-device-sign-in="kimi"');+ expect(html).toContain("Sign in with your Kimi Code membership so your bots can use Kimi");+ expect(html).toContain("Sign in to Kimi");+ expect(html).not.toContain("kimi login");+ });+});++it("keeps `kimi login` behind Prefer a terminal? in the desktop app's own window", () => {+ const html = render(signedOut, desktop);+ expect(html).toContain('data-device-sign-in="kimi"');+ expect(html).toContain("Prefer a terminal?");+ expect(html).toContain("kimi login");+});diff --git a/src/components/EngineSetup.tsx b/src/components/EngineSetup.tsxindex d632be37b6..be69851cb6 100644--- a/src/components/EngineSetup.tsx+++ b/src/components/EngineSetup.tsx@@ -597,7 +597,7 @@ export function EngineSetup({{deviceSignIn || browserSignIn ? (<><DeviceSignIn key={instance.instanceId} instanceId={instance.instanceId} browserPkce={browserSignIn} provider={provider} />- {deviceSignIn && provider === "grok" && signInCommand && serverTerminal(cloudHome) && (+ {deviceSignIn && provider !== "codex" && signInCommand && serverTerminal(cloudHome) && (<details className="mt-2 rounded-lg border border-hairline/50 bg-app px-2.5 py-2 text-[12px] text-ink-secondary"><summary className="cursor-pointer select-none">{t("engineSetup.preferTerminal")}</summary><CommandRow command={signInCommand} actionLabel={t("engineSetup.openSignIn")} compact />diff --git a/src/components/onboarding/SignInPill.tsx b/src/components/onboarding/SignInPill.tsxindex 298f09dde5..c7c491ad45 100644--- a/src/components/onboarding/SignInPill.tsx+++ b/src/components/onboarding/SignInPill.tsx@@ -37,17 +37,18 @@ export function useSignInPill(instance: InstanceInfo | undefined) {const [error, setError] = useState<string | null>(null);const id = instance?.instanceId ?? "";const method = instance?.authentication?.method;+ const provider = deviceSignInProvider(instance?.driverKind ?? "");const base = `/api/instances/${encodeURIComponent(id)}`;const live = useRef(true);useEffect(() => () => { live.current = false; }, []);const done = useCallback(async () => {- engineSignedIn(method === "paste-code" ? "claude" : deviceSignInProvider(instance?.driverKind ?? ""),+ engineSignedIn(method === "paste-code" ? "claude" : provider,method === "browser-pkce" ? "browser" : method === "paste-code" ? "code" : "device_code");try { await refreshInstances(); } catch {}try { await refreshModels(id); } catch {}if (live.current) setSlot({ kind: "start" });- }, [id, instance?.driverKind, method, refreshInstances, refreshModels]);+ }, [id, provider, method, refreshInstances, refreshModels]);const fail = (cause: unknown) => {if (!live.current) return;@@ -81,7 +82,6 @@ export function useSignInPill(instance: InstanceInfo | undefined) {if (link) await openExternalLink(link).catch(() => {});setSlot({ kind: "waiting", flowId: auth.flowId, link });} else {- const provider = deviceSignInProvider(instance?.driverKind ?? "");const code = isDeviceSignInCode(provider, auth.userCode) ? auth.userCode! : "";const link = deviceSignInLink(provider, auth.authorizationUrl, auth.userCode);if (link) await openExternalLink(link).catch(() => {});@@ -112,6 +112,11 @@ export function useSignInPill(instance: InstanceInfo | undefined) {.then(({ auth }: { auth: DeviceSignInStatus }) => {if (auth.phase === "succeeded") void done();else if (auth.phase !== "waiting") fail(new Error(auth.message ?? t("engineSetup.device.failed")));+ else if (isDeviceSignInCode(provider, auth.userCode)) {+ const code = auth.userCode;+ setSlot((current) => current.kind === "code" && current.flowId === polling && current.code !== code+ ? { ...current, code, link: deviceSignInLink(provider, auth.authorizationUrl, code) } : current);+ }}).catch(() => {});}, POLL_MS);@@ -119,7 +124,7 @@ export function useSignInPill(instance: InstanceInfo | undefined) {window.clearInterval(timer);controller.abort();};- }, [polling, base, done]);+ }, [polling, base, done, provider]);return { slot, error, install, start, submit };}diff --git a/src/lib/analytics-allowlist.ts b/src/lib/analytics-allowlist.tsindex 0844c8f77d..08720e92d2 100644--- a/src/lib/analytics-allowlist.ts+++ b/src/lib/analytics-allowlist.ts@@ -68,7 +68,7 @@ export const KEY_VIA = ["settings", "computer_panel", "chat_request", "apps", "mexport type KeyVia = (typeof KEY_VIA)[number];export const KEY_RESULT = ["ok", "rejected", "unverified", "error"] as const;export type KeyResult = (typeof KEY_RESULT)[number];-export const SIGN_IN_ENGINE = ["claude", "codex", "grok"] as const;+export const SIGN_IN_ENGINE = ["claude", "codex", "grok", "kimi"] as const;export const SIGN_IN_METHOD = ["code", "device_code", "browser"] as const;export type SignInMethod = (typeof SIGN_IN_METHOD)[number];export const BOT_SOURCE = ["blank", "template", "preset"] as const;diff --git a/src/locales/en.json b/src/locales/en.jsonindex c7096ba145..d8fdf69105 100644--- a/src/locales/en.json+++ b/src/locales/en.json@@ -5463,6 +5463,15 @@"engineSetup.grok.invalidChallenge": "Grok did not return a valid xAI sign-in link and code. Cancel and try again.","engineSetup.grok.notInstalled": "Grok with your grok.com subscription isn't installed here. Use an xAI API key instead.","engineSetup.grok.addKey": "Add xAI key",+ "engineSetup.kimi.description": "Sign in with your Kimi Code membership so your bots can use Kimi. You finish in your own browser; no terminal or password sharing needed.",+ "engineSetup.kimi.start": "Sign in to Kimi",+ "engineSetup.kimi.enterCode": "Enter this one-time code on Kimi's sign-in page:",+ "engineSetup.kimi.open": "Open Kimi sign-in",+ "engineSetup.kimi.security": "Only enter a code you requested here. This signs Kimi in for your bots with your Kimi Code membership and its limits. Your password stays with Moonshot AI, and the sign-in stays where your bots run.",+ "engineSetup.kimi.connected": "Kimi connected. Your models are being refreshed.",+ "engineSetup.kimi.connectedAccount": "Kimi connected",+ "engineSetup.kimi.failed": "Sign-in could not be completed. Try again, or check the Kimi installation.",+ "engineSetup.kimi.invalidChallenge": "Kimi did not return a valid sign-in link and code. Cancel and try again.","settings.domain.title": "Connect your domain","settings.domain.subtitle": "Enter your address, then copy the DNS record to your domain provider.","settings.domain.loading": "Loading server address…",